In PHP, the lcfirst()
function makes the first character of a string lowercase.
The following figure shows a visual representation of the lcfirst()
function.
lcfirst(str)
As a parameter, the lcfirst()
function requires a string whose first character is to be converted to lowercase.
The lcfirst()
function lowercases the first character of a string.
- The rest of the string i.e., except the first character, stays the same.
- If the first character is not a letter, then the entire string remains same.
The code below shows how the lcfirst()
function works.
<?php#stringecho("lcfirst('EDUCATIVE'): ");echo (lcfirst('EDUCATIVE'));echo("\n");#string with numberecho("lcfirst('EDUCAtIVE09'): ");echo (lcfirst('EDUCAtIVE09'));echo("\n");echo("lcfirst('09EDUCAtIVE'): ");echo (lcfirst('09EDUCAtIVE'));?>