The ucwords()
function takes string and converts the first letter of each
word to an uppercase character.
PHP ucwords() Function has the following syntax.
string ucwords ( string str )
str
is the string we want to convert.
PHP ucwords() function returns the converted string.
Convert words in a string to uppercase
<?PHP
$string = "this is a test from java2s.com";
$a = ucwords($string);
print($a);
?>
The code above generates the following result.