How to make first letter of a word capital?
You may want to use ucfirst(). For multibyte strings, please see this snippet.
You may want to use ucfirst(). For multibyte strings, please see this snippet.
This will capitalize all word’s first letters, and letters immediately after an apostrophe. It will make all other letters lowercase. It should work for you: str_replace(‘\’ ‘, ‘\”, ucwords(str_replace(‘\”, ‘\’ ‘, strtolower($last_name))));
How would I be able to capitalize the first letter of each word and lower case the incorrectly capitalized letters? ucwords() will capitilize the first letter of each word. You can combine it with strtolower() to first lowercase everything. For example: ucwords(strtolower(‘HELLO WORLD!’)); // Hello World!