3 * @version $Id: ucfirst.php,v 1.1 2006/02/25 13:50:17 harryf Exp $
8 //---------------------------------------------------------------
10 * UTF-8 aware alternative to ucfirst
11 * Make a string's first character uppercase
12 * Note: requires utf8_strtoupper
14 * @return string with first character as upper case (if applicable)
15 * @see http://www.php.net/ucfirst
16 * @see utf8_strtoupper
20 function utf8_ucfirst($str){
21 switch ( utf8_strlen($str) ) {
26 return utf8_strtoupper($str);
29 preg_match('/^(.{1})(.*)$/us', $str, $matches);
30 return utf8_strtoupper($matches[1]).$matches[2];