PHP ucfirst() function with example

PHP ucfirst() work: Here, we will find out about the ucfirst() work with an example.

PHP ucfirst() work

ucfirst() work is a string capacity, it is utilized to change over the first character to capitalized. It acknowledges string and returns a string with first capitalized character.

Syntax:

    ucfirst(string);

Example:

    Input: "this is MY computer!"
    Output: "This is MY computer!"

PHP Code:

<?PHP
    $str = "this is MY computer!";
    
    echo (ucfirst($str));
?>

Output:

This is MY computer!

Leave a Comment

error: Alert: Content is protected!!