Home > Article > Backend Development > How to use php ucwords function
php The ucwords function is used to convert the first character of each word to uppercase and return the converted string; the syntax is "ucwords(string)", and the parameter string is used to specify the string to be converted.
php ucwords
Function: Convert the first character of each word to uppercase
Syntax:
ucwords(string)
Parameters:
string Required, specifies the string to be converted
Description: Convert the first character of each word in the string to uppercase, this function Is binary safe.
php ucwords() function usage example 1:
<?php $i = "hello world"; $j = ucwords($i); echo $j; ?>
Output:
Hello World
php ucwords() function usage example 2:
<?php $i = "I'm study in php.cn"; $j = ucwords($i); echo $j; ?>
Output:
I'm Study In Php.cn
The above is the detailed content of How to use php ucwords function. For more information, please follow other related articles on the PHP Chinese website!