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
This means thatstring lcfirst ( string $str )
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:
Function Part | Description |
---|---|
string | Type of value this function returns, which is a string |
lcfirst | The function name |
string | Parameter type, this function accepts only string data type |
$str | Parameter 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.