lcfirst() Lowercase first character of a string

In this tutorial you'll learn, how to lowercase the first character of a string.

The lcfirst() function lowercased the first character of a string if that character is alphabetic.

lcfirst() prototype

string lcfirst ( string $str )
This means that lcfirst() accepts string and returns a manipulated string (lowercased the first character). We could rewrite the above function definition in an easy to understandable way:
Explanation of lcfirst() function definition
Function PartDescription
stringType of value this function returns, which is a string
lcfirstThe function name
stringParameter type, this function accepts only string data type
$strParameter name, a variable that holds the data

Syntax

lcfirst($str)

Return Value

lcfirst() function returns string, with lowercased the first character if that character is alphabetic.

Examples

Example 1

<?php
    $str 
'I AM PHP STRING';
    
//lowercase first character of string
    
$LowerFirst lcfirst($str);
    echo 
$LowerFirst;
    
//prints: i AM PHP STRING
?>

The above code prints i AM PHP STRING on browser screen.

Contents and Related Tutorials

  1. Make string first's character uppercase
  2. Make string first's character lowercase
  3. Make a string lowercase
  4. Make a string uppercase
  5. Uppercase first character of each word in a string