note 43243 added to function.strtoupper
| From: | rene18 at estpak dot ee | Date: | Tue, 15 Jun 2004 12:02:36 +0000 |
| Subject: | note 43243 added to function.strtoupper | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-71093@lists.php.net to get a copy of this message | ||
I needed a function that would make the first letter of each word, in a sentence, to uppercase. But
I couldn't find a nice and short one, so I wrote it myself:
<?php
function WordUpper($sentence) {
$words = split(" ",$sentence);
foreach ($words as $toupper)
$ret .= " ".substr_replace($toupper,strtoupper(substr($toupper,0,1)),0,1);
substr_replace($ret,"",0,1);
return $ret;
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.strtoupper.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+43243
Delete -- http://master.php.net/manage/user-notes.php?action=delete+43243&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+43243&report=yes
Search -- http://master.php.net/manage/user-notes.php