lcfirst – PHP String Functions
Syntax :
Description :
lcfirst() function will take string as input and converts its first letter to lowercase letter, if that character is alphabetic. In general language, its name implies LC = lower Case first letter in a string.
Parameter :
- string – This is a Required parameter. This is a string on which function will be performed.
Output :
This will return a string with first letter converted to lowercase.
Related articles :
[table caption=”” width=”100%” colwidth=”50%|50%” colalign=”left|left”]
Version, Description
ucwords,first letter of every word in a string to uppercase letter
strtolower,converts all letter of a string to lowercase letter
strtoupper,converts all letter of a string to uppercase letter
ucfirst,converts first letter of a string to uppercase letter
[/table]
lcfirst() – PHP Functions Example 1 :
<?php $strExample = "An example of a lcfirst() function."; echo lcfirst($strExample); ?>
In above example ,We have a string ‘An example of a lcfirst() function’. Now this function will converts first letter in a string to lowercase. See below is the output of above code.
lcfirst() – PHP Functions Example 2 :
<?php $strExample = "1. This is an example of lcfirst() function with numbers."; echo ucfirst($strExample); ?>
In above example ,We have a string ‘1. This is an example of lcfirst() function with numbers.’. Now this function will converts every letter in a word to lowercase, it will not do anything with numeric values. See below is the output of above code.