Home >>PHP String Functions >PHP ucfirst() Function
PHP ucfirst() function is used to convert the first character of a given input string into the uppercase. It takes a string as input and convert the first letter of that string to uppercase and all the other characters remains unchanged.
Syntax:
ucfirst($string);
Parameter | Description |
---|---|
string | This is a required parameter. This parameter defines the input string to convert. |
Here is an example of ucfirst() function in PHP:
<html> <body> <?php echo ucfirst("phptpoint"); ?> </body> </html>
Here is an another example of ucfirst() function in PHP:
<html> <body> <?php $str = "some text here..."; echo ucfirst($str); ?> </body> </html>