How to Capitalize the First Word of a String in PHP

In this article, we go over how to capitalize the first word of a string in PHP using the ucfirst() function.
The ucfirst() function capitalizes the first word in a string.
So, if we have the string "bob went to the park today", after passing it through the ucfirst() function,
the string
would then change to "Bob went to the park today."
Example
Below is an example of the ucfirst() function in action.
Actual PHP Output
Bob went to the store
The ucfirst() function is the function to use when you want to capitalize the first word in a string.
HTML Comment Box is loading comments...