PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

levenshtein> <join
Last updated: Fri, 05 Sep 2008

view this page in

lcfirst

(No version information available, might be only in CVS)

lcfirstMet le premier caractère en minuscule

Description

string lcfirst ( string $str )

Retourne une chaîne dont le premier caractère de str a été mis en minuscule, si ce caractère est un caractère alphabétique.

Notez que 'alphabétique' est déterminé par la locale courante. Actuellement, dans la locale par défaut "C", les caractères comme a-umlaut (ä) ne sera pas converti.

Liste de paramètres

str

La chaîne d'entrée.

Valeurs de retour

Retourne la chaîne résultante.

Exemples

Exemple #1 Exemple avec lcfirst()

<?php
$foo 
'HelloWorld';
$foo lcfirst($foo);             // helloWorld

$bar 'HELLO WORLD!';
$bar lcfirst($bar);             // hELLO WORLD!
$bar lcfirst(strtoupper($bar)); // hELLO WORLD!
?>



add a note add a note User Contributed Notes
lcfirst
pablo dot swp at gmail dot com
06-Sep-2008 03:26
Hi, this implementation of lcfirst doesn´t work for me, it returns me an array. I used this instead:

$str = strtolower( substr($str, 0, 1) ) . substr($str, 1, strlen($str))
harmor
06-May-2008 12: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!!!"  */

levenshtein> <join
Last updated: Fri, 05 Sep 2008
 
 
show source | credits | sitemap | contact | advertising | mirror sites