The ucwords Function
The ucwords function converts the first
character of each word in a string to uppercase.
Works correctly only with Latin characters (single-byte characters).
Syntax
ucwords(string $string, string $separators = " \t\r\n\f\v"): string
Example
Let's convert each word of the string to uppercase:
<?php
echo ucwords('lorem ipsum dolor sit amet');
?>
Code execution result:
'Lorem Ipsum Dolor Sit Amet'
See Also
-
the
ucfirstfunction,
converting the first character to uppercase -
the
lcfirstfunction,
converting the first character to lowercase -
the
strtoupperfunction,
converting a string to lowercase -
the
strtolowerfunction,
converting a string to uppercase