note 82996 added to function.lcfirst
| From: | harmor at osu1 dot php dot net | Date: | Mon, 05 May 2008 22:43:12 +0000 |
| Subject: | note 82996 added to function.lcfirst | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-139085@lists.php.net to get a copy of this message | ||
A slight modification from Northie's post here ( http://us2.php.net/manual/en/function.ucfirst.php#68443),
where lcfirst may not exist in your PHP build:
<?php
if(false === function_exists('lcfirst'))
{
/**
* Make a string's first character lowercase
*
* @param string $str
* @return string the resulting string.
*/
function lcfirst( $str ) {
$str[0] = strtolower($str[0]);
return (string)$str;
}
}
/* Tests */
echo var_dump(lcFirst(NULL)).'<br />'; /* string(0) "" */
echo var_dump(lcFirst('')) .'<br />'; /* string(0) "" */
echo var_dump(lcFirst('S')) .'<br />'; /* string(1) "S" */
echo var_dump(lcFirst('Ã')) .'<br />'; /* string(0)
"�" */
echo var_dump(lcFirst('Hello World!!!')); /* string(14) "hello World!!!" */
----
Server IP: 64.71.164.2
Probable Submitter: 66.27.49.42
----
Manual Page -- http://www.php.net/manual/en/function.lcfirst.php
Edit -- https://master.php.net/note/edit/82996
Del: integrated -- https://master.php.net/note/delete/82996/integrated
Del: useless -- https://master.php.net/note/delete/82996/useless
Del: bad code -- https://master.php.net/note/delete/82996/bad+code
Del: spam -- https://master.php.net/note/delete/82996/spam
Del: non-english -- https://master.php.net/note/delete/82996/non-english
Del: in docs -- https://master.php.net/note/delete/82996/in+docs
Del: other reasons-- https://master.php.net/note/delete/82996
Reject -- https://master.php.net/note/reject/82996
Search -- https://master.php.net/manage/user-notes.php