PHP ucfirst() Function

PHP ucfirst() Function

The ucfirst() function in PHP converts the first character of the specified string to uppercase.

Syntax

ucfirst ( string $str )

Parameter

str(required)- This parameter represents the input string.

Return

This function returns a string with the first character of the specified string capitalized if that character is alphabetic.

Example 1

 

Output

Actual String: pHP is an easy language to learn.
After ucfirst() function...
New string: PHP is an easy language to learn. 

Example 2

 

Output

After ucfirst() function...
Hello world! 

Example 3

 

Output

email id: 
After ucfirst() function...
email id: