ucwords function returns a string with the first character of each word in str capitalized, if that character is alphabetic.
For example, ucwords(“4 rapid development”); will return “4 Rapid Development” string.
However, if you’re working with UTF-8 string, use a function as below:
1. Uppercase the first character of each word with UTF-8 function
[php] <?phpfunction mb_ucwords($str) {
$str = mb_convert_case($str, MB_CASE_TITLE, "UTF-8");
return ($str);
}
?>
[/php]
2. Usage
[php] <?phpecho mb_ucwords("việt nam hồ chí minh");
//Việt Nam Hồ Chí Minh
?>
[/php]