Uppercasing the First Character of a String

Learn how to uppercase the first character of a string.

Basic structure of the ucfirst helper method

The ucfirst helper method is used to uppercase the first character of a string. It defines only one parameter (the $string), which will have its first character uppercased. The basic structure of ucfirst function is shown below.

Get hands-on with 1200+ tech skills courses.