
Suppose that you have a text string which is a sentence, and you want to capitalize the first letter of each word in the sentence. The code below will show you can do this with PHP.
The Code
1 2 3 4 |
<?php $thesentence = "the quick brown fox jumped over the lazy dog."; echo ucwords ( $thesentence ); //prints out "The Quick Brown Fox Jumped Over The Lazy Dog." ?> |