ucfirst

string ucfirst(string string) 

Makes the first character in a string uppercase.

Returns:

String; FALSE on error

Description:

ucfirst() attempts to convert the first character in a string to uppercase.

Note:

The function works on the first character in a string—not the first letter character in a string. This means that a string like ' foiled by a leading space' will be unchanged due to the leading space.

Caution:

This function is likely to give unexpected results with non-ASCII character sets. In cases like this, it’s best to code your own replacement function. See ucwords() for a simple example that can easily be modified to fit this need.

Version:

PHP 3+, PHP 4+

See also:

To convert the first character of each word in a string to ...

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.