note 90871 modified in function.strtolower by danbrown
| From: | danbrown@php.net | Date: | Thu, 14 May 2009 01:15:36 +0000 |
| Subject: | note 90871 modified in function.strtolower by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-154580@lists.php.net to get a copy of this message | ||
Could be useful, if mb string library is not available for whatever the reason:
<?php
function utf8_strtolower($string) {
return utf8_encode(strtolower(utf8_decode($string)));
}
##equally.....
function utf8_ucfirst($string) {
return utf8_encode(ucfirst(utf8_decode($string)));
}
#.....etc...
?>
It has worked for me, just make sure you feed the functions with the proper encoded text (utf-8)
[These functions] only work when translation is between common characters in ISO 8859-1 and UTF-8,
that means they will work well with western languages but not cyrillic or asian.
--was--
Could be useful, if mb string library is not available for whatever the reason:
<?php
function utf8_strtolower($string) {
return utf8_encode(strtolower(utf8_decode($string)));
}
##equally.....
function utf8_ucfirst($string) {
return utf8_encode(ucfirst(utf8_decode($string)));
}
#.....etc...
?>
It has worked for me, just make sure you feed the functions with the proper encoded text (utf-8)
http://php.net/manual/en/function.strtolower.php