The ucwords() function is used to convert the first character of a string to uppercase in each string.
Syntax
ucwords(str)
Parameters
str − The specified string
Return
The ucfirst() function returns the converted string.
Example
The following is an example −
<?php echo ucwords("This is it!"); ?>
Output
The following is the output −
This Is It!
Example
Let us see another example −
<?php $s = "#demo#text"; $sep = '$'; $res = ucwords($s, $sep); print_r($res); ?>
Output
The following is the output −
#demo#text