Computer >> Computer tutorials >  >> Programming >> PHP

lcfirst() function in PHP


The lcfirst function is used to make a string's first character should be lowercase. It returns the converted string.

Syntax

lcfirst(str)

Parameters

  • str − The string to convert.

Return

The lcfirst() function returns the converted string.

Example

The following is an example −

<?php
   echo lcfirst("Welcome to the website");
?>

Output

The following is the output −

welcome to the website

Example

Let us see another example −

<?php
   $res = 'WEB WORLD!';
   $res = lcfirst($res);
   echo $res;
   $res = lcfirst(strtoupper($res));
   echo $res;
?>

Output

The following is the output −

wEB WORLD!wEB WORLD!