I want to know how to capitalize in PHP
+10
A:
echo strtoupper('hello');
strtoupper will capitalize the whole string.
If you're only interested in capitalizing the first letter, you can use ucfirst:
echo ucfirst('hello!'); //Hello!
If you want to capitalize the first letter of each word in a string, use ucwords:
echo ucwords('hello world!'); //Hello World!
karim79
2009-06-28 09:59:28
ucwords(), also.
jason
2009-06-28 14:42:05
@jason - Yep, that makes the answer more complete. Thanks.
karim79
2009-06-28 15:03:11