RE: [PHP] Replacing 2 strings
| From: | Murray @ PlanetThoughtful | Date: | Mon, 30 May 2005 16:58:12 +0000 |
| Subject: | RE: [PHP] Replacing 2 strings | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-215997@lists.php.net to get a copy of this message | ||
> AHHH! ucwords(); I probably looked right at it a million times.. I knew
> there had to be something to do that....
Lol, I know that feeling well!
One thing, btw, looking at the solution you provided. Once you'd
preg_split()ed the string into component words, you could have simply
applied strtoupper() directly to the first character of each word in your
foreach loop.
As an example:
<?
$string = "this";
$string{0} = strtoupper($string{0});
echo $string; // should return value of "This"
?>
Just thought it was worth mentioning.
Regards,
Murray