PHP Capitalize First Letter of Each Word
To capitalize the first letter of each word in a PHP string, we need to use the PHP ucwords() in-built function. This function is used to capitalize the first character of every word of a string. If we are in a situation where all the lowercase of the first character of a string change into uppercase, then we use ucword() function.
Ex:
<!DOCTYPE html>
<html>
<body>
<?php
$str1 = "the name's bond, james bond";
echo ucwords($str1);
?>
</body>
</html>
Output: