Source for file ucwords.php
Documentation is available at ucwords.php
* @version $Id: ucwords.php,v 1.1 2007/09/09 20:39:49 pitlinz Exp $
//---------------------------------------------------------------
* UTF-8 aware alternative to ucwords
* Uppercase the first character of each word in a string
* Note: requires utf8_substr_replace and utf8_strtoupper
* @return string with first char of each word uppercase
* @see http://www.php.net/ucwords
// Note: [\x0c\x09\x0b\x0a\x0d\x20] matches;
// form feeds, horizontal tabs, vertical tabs, linefeeds and carriage returns
// This corresponds to the definition of a "word" defined at http://www.php.net/ucwords
$pattern =
'/(^|([\x0c\x09\x0b\x0a\x0d\x20]+))([^\x0c\x09\x0b\x0a\x0d\x20]{1})[^\x0c\x09\x0b\x0a\x0d\x20]*/u';
//---------------------------------------------------------------
* Callback function for preg_replace_callback call in utf8_ucwords
* You don't need to call this yourself
* @param array of matches corresponding to a single word
* @return string with first char of the word in uppercase
$leadingws =
$matches[2];
return $leadingws .
$ucword;
Documentation generated on Thu, 08 Jan 2009 17:48:59 +0100 by phpDocumentor 1.4.0a2