<?phpAs the example shown, you must convert the sentence to lower character first otherwise it may not work.
$foo = 'I ATE APPLE!';
$foo = ucwords($foo); //I Ate Apple!
$bar = 'I ATE APPLE!!';
$bar = ucwords($bar); // I ATE APPLE!!
$bar = ucwords(strtolower($bar)); //I Ate Apple!
?>
Saturday, September 14, 2013
[PHP] make first character of each word to uppercase.
What's ucwords() function for ?
It is for "Returning a string with the first character of each word in str capitalized, if that character is alphabetic."
分類:
PHP
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment