PHP ucfirst() Function
Example
Convert the first character of "hello" to uppercase:
<?php echo ucfirst("hello world!"); ?>
Definition and Usage
The ucfirst() function converts the first character of the string to uppercase.
Related Functions:
- lcfirst() - Convert the first character of the string to lowercase
- strtolower() - Convert the string to lowercase
- strtoupper() - Convert the string to uppercase
- ucwords() - Convert the first character of each word in the string to uppercase
Syntax
ucfirst(string)
Parameter | Description |
---|---|
string | Required. Specifies the string to be converted. |
Technical Details
Return Value: | Return the converted string. |
PHP Version: | 4+ |