note 111145 deleted from function.lcfirst by googleguy
| From: | googleguy@php.net | Date: | Sun, 20 Jan 2013 00:27:01 +0000 |
| Subject: | note 111145 deleted from function.lcfirst by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-193273@lists.php.net to get a copy of this message | ||
Note Submitter: qeremy [atta] gmail [dotta] com
----
A simple approach to unicode lc;
<?php
function lcfirst_unicode($str) {
return mb_convert_case(
mb_substr($str, 0, 1), MB_CASE_LOWER) .
mb_substr($str, 1);
}
?>
By the way...
<?php
function lcwords_unicode($str) {
return preg_replace_callback('/(\w+)/u', function($s) {
return lcfirst_unicode($s[1]);
}, $str);
}
?>