Problem:
You want to make capitalize first letter of every word in a string.
Solution:
Use built-in function ucwords() to make first character of each word in a string uppercase.
See the following example-
[php]
<?php
$string = "In theory, theory and practice are the same. In practice, they are not.";
echo "Original string: ". $string. "<br />";
$string = ucwords($string);
echo "Converted string: ". $string;
?>
[/php]
[wpdm_file id=144]
Output:
Original string: In theory, theory and practice are the same. In practice, they are not.
Converted string: In Theory, Theory And Practice Are The Same. In Practice, They Are Not.