Home > Article > Backend Development > PHP converts the first character of each word in a string to uppercase using the function ucwords()
Example
Convert the first character of each word to uppercase:
<?php echo ucwords("hello world"); ?>
Definition and usage
ucwords() function converts the string Convert the first character of each word in to uppercase.
Note: This function is binary safe.
Related functions:
##ucfirst() - Convert the first character in the string to uppercase
lcfirst() - Convert the first character in the string to lowercase
strtoupper() - Convert the string to Uppercase
strtolower() - Convert the string to lowercase
ucwords(string)
Description | |
Required. Specifies the string to be converted. |
Returns the converted string | |
4+ |
<?php echo ucwords("hello world"); ?>
The above is the detailed content of PHP converts the first character of each word in a string to uppercase using the function ucwords(). For more information, please follow other related articles on the PHP Chinese website!