note 94227 deleted from function.ucfirst by danbrown
| From: | danbrown@php.net | Date: | Fri, 23 Oct 2009 15:32:09 +0000 |
| Subject: | note 94227 deleted from function.ucfirst by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-162020@lists.php.net to get a copy of this message | ||
Note Submitter: pahan [ at ] hubbitus [ . ] spb [ . ] su
----
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
?>