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
ucfirst
function,
converting the first character to uppercase -
the
lcfirst
function,
converting the first character to lowercase -
the
strtoupper
function,
converting a string to lowercase -
the
strtolower
function,
converting a string to uppercase