Wednesday 24 March 2021

Php: lcfirst: Make a string's first character lowercase

Signature

lcfirst ( string $string ) : string

 

Description

Returns a string with the first character of string lowercased if that character is alphabetic. This will not update the original string.

 

Example

$msg2 = lcfirst($msg1);

 

lcfirst_demo.php

#!/usr/bin/php

<?php

    $msg1 = "Hello world";
    $msg2 = lcfirst($msg1);

    echo "msg1 : $msg1\n";
    echo "msg2 : $msg2\n";

?>

 

Output

$./lcfirst_demo.php 

msg1 : Hello world
msg2 : hello world

 

 

 

Previous                                                    Next                                                    Home

No comments:

Post a Comment