You want to make capitalize first letter of every word in a string.
Use built-in function ucwords() to make first character of each word in a string uppercase.
See the following example-
<?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; ?>
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.