PHP string lcfirst() Function

The lcfirst() is in-built PHP string function. It is used to convert the first character of a string to lowercase. In another words we can say that it make a string's first character lowercase. It returns the converted string.

Following are the related functions.

  • ucfirst() : It is used to convert first character of a string to uppercase.
  • ucwords() : It is used to convert first character string to uppercase.
  • strtoupper() : It is used to convert a string to uppercase.
  • strtolower() : It is used to convert a string to lowercase.

Syntax:

ParameterDescriptionRequired/Optional
StringSpecify the string to convertrequired

Example 1

Output:

Before using lcfirst() function:PHP
After using 'lcfirst()' function: pHP

Example 2

Output:

Before using lcfirst() function: HELLO PHP
After using 'lcfirst()' function: hELLO PHP

Next TopicPHP String




Latest Courses