PHP Function Reference

PHP lcfirst() Function



The PHP lcfirst() function returns the string with first character of the specified string in the lowercase. Any symbol, space, special character or number in the string is ignored while applying this function. Only Alphabets are converted.

Note: Alphabet is determined by the current locale. For instance, in the default "C" locale characters such as umlaut-a (ä) will not be converted.

Syntax

lcfirst(string)

Parameters

string Required. Specify the string to convert

Return Value

Returns the string with first character of the specified string in lowercase.

Example:

The example below shows the usage of lcfirst() function.

<?php
$str1 = "Hello World!";
$lcf_str1 = lcfirst($str1);
echo $lcf_str1."\n";

$str2 = "HELLO WORLD!";
echo lcfirst($str2)."\n";
echo lcfirst(strtolower($str2))."\n";
?>

The output of the above code will be:

hello World!
hELLO WORLD!
hello world!

❮ PHP String Reference