note 73363 added to function.strtoupper
| From: | lskatz at gmail dot com | Date: | Tue, 20 Feb 2007 05:40:50 +0000 |
| Subject: | note 73363 added to function.strtoupper | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-123589@lists.php.net to get a copy of this message | ||
So far my function to capitalize all the words in a string has been good. It will convert any
whitespace to a space though.
function capitalize($word){
$output='';
$word=preg_split('/\s+/',$word);
for($i=0;$i<count($word);$i++){
$char=substr($word[$i],0,1);
$char=strtoupper($char);
$output.=$char . substr($word[$i],1);
if($word[$i+1]) $output.=' ';
}
return $output;
}
----
Server IP: 69.147.83.197
Probable Submitter: 76.17.125.162
----
Manual Page -- http://www.php.net/manual/en/function.strtoupper.php
Edit -- https://master.php.net/note/edit/73363
Del: integrated -- https://master.php.net/note/delete/73363/integrated
Del: useless -- https://master.php.net/note/delete/73363/useless
Del: bad code -- https://master.php.net/note/delete/73363/bad+code
Del: spam -- https://master.php.net/note/delete/73363/spam
Del: non-english -- https://master.php.net/note/delete/73363/non-english
Del: in docs -- https://master.php.net/note/delete/73363/in+docs
Del: other reasons-- https://master.php.net/note/delete/73363
Reject -- https://master.php.net/note/reject/73363
Search -- https://master.php.net/manage/user-notes.php