note 50884 added to function.ucfirst
| From: | php-general at lists dot php dot net | Date: | Sun, 13 Mar 2005 01:11:28 +0000 |
| Subject: | note 50884 added to function.ucfirst | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-86342@lists.php.net to get a copy of this message | ||
Ah, the last code were spoiled, here is the fixed one:
<?php
function uc_first($str){
$str[0] = strtr($str,
"abcdefghijklmnopqrstuvwxyz".
"\x9C\x9A\xE0\xE1\xE2\xE3".
"\xE4\xE5\xE6\xE7\xE8\xE9".
"\xEA\xEB\xEC\xED\xEE\xEF".
"\xF0\xF1\xF2\xF3\xF4\xF5".
"\xF6\xF8\xF9\xFA\xFB\xFC".
"\xFD\xFE\xFF",
"ABCDEFGHIJKLMNOPQRSTUVWXYZ".
"\x8C\x8A\xC0\xC1\xC2\xC3\xC4".
"\xC5\xC6\xC7\xC8\xC9\xCA\xCB".
"\xCC\xCD\xCE\xCF\xD0\xD1\xD2".
"\xD3\xD4\xD5\xD6\xD8\xD9\xDA".
"\xDB\xDC\xDD\xDE\x9F");
return $str;
}
?>
So, this function changes also other letters into uppercase, ucfirst() does only change: a-z to:
A-Z.
----
Manual Page -- http://www.php.net/manual/en/function.ucfirst.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+50884
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+50884&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+50884&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+50884&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+50884&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+50884&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+50884&report=yes
Search -- http://master.php.net/manage/user-notes.php