PHP lcfirst() Function

PHP lcfirst() Function converts only the first character of a string into lowercase. The lcfirst() Function is php in-built function.

Syntax :

lcfirst(string);

Parameters ,

string : Required. It is required to make only the first characters of string to lowercase.

It returns the lowercased first characters of whole string.

Similar function of lcfirst() :

    ucwords(): It makes the first character of each word to uppercase in string..
    strtolower() : It converts a whole string into lowercase.
    ucfirst() : It converts only the first character of a string into uppercase.
    strtoupper() : It converts a whole string into uppercase.

Let's see below example to understand php lcfirst() Function in details.

Example :

<?php
$str= 'LEARN PHP LCFIRST FUNCTION TUTORIAL AT ARYATECHNO!';
$result1= lcfirst($str);
echo "<br> lcfirst function for uppercase string : ".$result1;

$str= 'learn php lcfirst function tutorial at aryatechno!';
$result1= lcfirst(strtoupper($str));
echo "<br> lcfirst function for lowercase string : ".$result1;
?>

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

35105