note 94227 modified in function.ucfirst by danbrown

From: Date: Fri, 23 Oct 2009 15:32:02 +0000
Subject: note 94227 modified in function.ucfirst by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-162019@lists.php.net to get a copy of this message
UTF-8 variant is sibple through mb_strtoupper: <?php /** * Unicode variant of ucfirst! * Idea got from http://php.net/manual/en/function.ucfirst.php#87133 but its implementation * is very long and hard without reason. * * @uses mb_strtoupper * @param string $str String to process * @param string=UTF-8 $enc * @return string **/ function unicode_ucfirst($str, $enc = 'UTF-8'){ return preg_replace('/^./ue', "mb_strtoupper('\\0', '$enc')", $str); }#f unicode_ucfirst ?> --was-- UTF-8 variant is sibple through mb_strtoupper: /** * Unicode variant of ucfirst! * Idea got from http://php.net/manual/en/function.ucfirst.php#87133 but its implementation * is very long and hard without reason. * * @uses mb_strtoupper * @param string $str String to process * @param string=UTF-8 $enc * @return string **/ function unicode_ucfirst($str, $enc = 'UTF-8'){ return preg_replace('/^./ue', "mb_strtoupper('\\0', '$enc')", $str); }#f unicode_ucfirst ?> http://php.net/manual/en/function.ucfirst.php

« previous php.notes (#162019) next »