PHP lcfirst() function with example

By IncludeHelp Last updated : December 27, 2023

PHP lcfirst() function

The lcfirst() function is a string function, it is used to convert first character to lowercase. It accepts string and returns string with first lowercase character.

Syntax

The syntax of the lcfirst() function:

lcfirst(string);

Parameters

The parameters of the lcfirst() function:

  • string: An input parameter.

Sample Input/Output

Input: "THIS is MY computer!"
Output: "tHIS is MY computer!"

Example of PHP lcfirst() Function

<?PHP
$str = "THIS is MY computer!";

echo (lcfirst($str));
?>

Output

The output of the above example is:

tHIS is MY computer!

To understand the above example, you should have the basic knowledge of the following PHP topics:

Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.