Re: preg_replace \\1 yIKES!

From: Date: Wed, 14 Jun 2006 15:05:14 +0000
Subject: Re: preg_replace \\1 yIKES!
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-237976@lists.php.net to get a copy of this message
At 3:45 AM -0700 6/14/06, sam wrote: >On Jun 13, 2006, at 1:58 PM, tedd wrote: > >>At 11:33 AM -0700 6/13/06, sam wrote: >>>Wow this is hard I can't wait till I get the hang of it. >>> >>>Capitalize the first letter of a word. >> >>Try: >> >><?php >>$word = "yikes"; >>$word[0]=strtoupper($word[0]); >>echo($word); >>?> > > >This blows my mind. What should one think, "everything is an array"? Well, okay not >every but everything that's in linear consecutive order; anything that can be indexed? > >I was trying to make an array from $word but explode() doesn't take an empty delimiter so I >gave up and went for the preg_replace. Sorry, it was a throwback to my C days -- using ucfist() is better. tedd -- ------------------------------------------------------------------------------------ http://sperling.com http://ancientstones.com http://earthstones.com

« previous php.general (#237976) next »