PHP Manual
Prev |  | Next

# ucfirst

ucfirst -- Make a string's first character uppercase.

## Description

`string ucfirst`(string str);

Capitalizes the first character of `str` if that character is alphabetic.

Note that 'alphabetic' is determined by the current locale. For instance, in the default "C" locale characters such as umlaut-a (ä) will not be converted.

Example 1. ucfirst() example

      1
      2 $text = 'mary had a little lamb and she loved it so.';
      3 $text = ucfirst($text); // $text is now Mary had a little lamb and she loved it so.
      4

See also strtoupper() and strtolower().

Prev | Home | Next
trim | Up | ucwords