lcfirst()

lcfirst() — Make a string's first character lowercase.

Built-in function of PHP 8.5. The manual lists it as available in PHP 5 >= 5.3.0, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.

What it does

Returns a string with the first character of string lowercased if that character is an ASCII character in the range "A" (0x41) to "Z" (0x5a).

Signature

lcfirst(string $string): string

Parameters

ParameterTypeWhat it takes
$stringstringThe input string.

Return value

Returns the resulting string.

Example

A runnable snippet:

$foo = 'HelloWorld'; echo lcfirst($foo), PHP_EOL; // helloWorld $bar = 'HELLO WORLD!'; echo lcfirst($bar), PHP_EOL; // hELLO WORLD! echo lcfirst(strtoupper($bar)), PHP_EOL; // hELLO WORLD!

Changelog

VersionChange
8.2.0Case conversion no longer depends on the locale set with setlocale(). Only ASCII characters will be converted.

See also

ucfirst(), strtolower(), strtoupper(), ucwords()

All PHP 8.5 built-in functions

Reference card built from the PHP manual page lcfirst() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.