lcfirst() function in PHP || PHP lcfirst function
×


lcfirst() function in php

0 395

lcfirst() function of PHP is used to converts the first character of a string to lowercase. It is an inbuilt function of PHP. The return type of this function is a string.

Syntax:

lcfirst($string);

here,

$string is a PHP string whose first character is converted to uppercase by this function.


Example 1:

<?php
$str="codingtag";
$u_str=ucfirst($str);
echo "Modified string is : $u_str";
?>

Output:

Note: In case of more than one word in a string this function will convert the first character of the first word to uppercase.

Example 2:

<?php
$str="welcome to coding tag";
$u_str=ucfirst($str);
echo "Modified string is : $u_str";
?>

Output:




Share:


Leave a Reply


Comments
    Waiting for your comments