In some cases maybe more useful?
$lower = strtolower( substr($upper,0,1) ) . substr($upper,1);
lcfirst
(No version information available, might be only in CVS)
lcfirst — Make a string's first character lowercase
Descrição
string lcfirst
( string $str
)
Returns a string with the first character of str , lowercased if that character is alphabetic.
Note that 'alphabetic' is determined by the current locale. For instance, in the default "C" locale characters such as umlaut-a (ä) will not be converted.
Parâmetros
- str
-
The input string.
Valor Retornado
Returns the resulting string.
Exemplos
Exemplo #1 lcfirst() example
<?php
$foo = 'HelloWorld';
$foo = lcfirst($foo); // helloWorld
$bar = 'HELLO WORLD!';
$bar = lcfirst($bar); // hELLO WORLD!
$bar = lcfirst(strtoupper($bar)); // hELLO WORLD!
?>
lcfirst
alex aulbach
06-Oct-2008 09:20
06-Oct-2008 09:20
harmor
05-May-2008 03:43
05-May-2008 03:43
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!!!" */
