Capitalize first letter of every word in string using PHP


In some cases we want to display the string in a good looking form. We want to capitalize(upper case) the first letter of each word of the particular string. For this we use the PHP function ucwords(). We have to just pass the string variable or strings into the function.

<?php ucwords("hello world") ;?>

Output

Hello World
Chapter Next »