Convert the first character of "hello" to uppercase:
<?phpecho ucfirst("hello world!");?>The ucfirst() function converts the first character in a string to uppercase.
Related functions:
lcfirst() - Converts the first character in a string to lowercase
ucwords() - Converts the first character of each word in a string to uppercase
strtoupper() - Convert a string to uppercase
strtolower() - Convert a string to lowercase
ucfirst( string )
| parameter | describe |
|---|---|
| string | Required. Specifies the string to be converted. |
| Return value: | Returns the converted string. |
|---|---|
| PHP version: | 4+ |