note 104627 added to function.ucfirst
| From: | anatoly dot pashin at gmail dot com | Date: | Mon, 27 Jun 2011 05:49:16 +0000 |
| Subject: | note 104627 added to function.ucfirst | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-180976@lists.php.net to get a copy of this message | ||
Re: chris at bjelleklang dot org 26-Jan-2011 11:03
Your code works fine for NON-utf-8 strings.
Tested on cyrillic, got error.
Here is solution:
<?php
if ( ! function_exists( 'mb_ucfirst' ) ) {
function mb_ucfirst( $string ) {
return mb_strtoupper( mb_substr( $string , 0, 1 ) ) . mb_substr( $string , 1 );
}
}
?>
----
Server IP: 195.54.192.44
Probable Submitter: 127.0.0.1
----
Manual Page -- http://www.php.net/manual/en/function.ucfirst.php
Edit -- https://master.php.net/note/edit/104627
Del: integrated -- https://master.php.net/note/delete/104627/integrated
Del: useless -- https://master.php.net/note/delete/104627/useless
Del: bad code -- https://master.php.net/note/delete/104627/bad+code
Del: spam -- https://master.php.net/note/delete/104627/spam
Del: non-english -- https://master.php.net/note/delete/104627/non-english
Del: in docs -- https://master.php.net/note/delete/104627/in+docs
Del: other reasons-- https://master.php.net/note/delete/104627
Reject -- https://master.php.net/note/reject/104627
Search -- https://master.php.net/manage/user-notes.php