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, 27 Jun 2008

view this page in

lcfirst

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

lcfirst — Make a string's first character lowercase

Opis

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.

Parametry

str

The input string.

Zwracane wartości

Returns the resulting string.

Przykłady

Example #1 lcfirst() example

<?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
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, 27 Jun 2008
 
 
show source | credits | sitemap | contact | advertising | mirror sites