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