Re: What's the problem with this PHP code?

From: Date: Fri, 04 Nov 2011 07:52:19 +0000
Subject: Re: What's the problem with this PHP code?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-315591@lists.php.net to get a copy of this message
On Fri, Nov 4, 2011 at 1:47 PM, Sophia <red_angel@techno-info.com> wrote: > Here is the PHP code: > > > <?php > > > $panka = " c:can-it-rock- > :the-boat-of- > :love- "; > > $pankb = preg_split(':',$panka); > It should be preg_split('/:/', $panka); > $pankc = $pankb{"1"}; > > echo "(" . $panka . ")\n(" . $pankc . ")\n"; > > > ?> > > > > > > > I keep getting the following error: > > Sophia-Shapiras-MacBook-Pro:**tmp red_angel$ > Sophia-Shapiras-MacBook-Pro:**tmp red_angel$ php testo.php > > Warning: preg_split(): No ending delimiter ':' found in > /Users/red_angel/tmp/testo.php on line 8 > ( c:can-it-rock- > :the-boat-of- > :love- ) > () > Sophia-Shapiras-MacBook-Pro:**tmp red_angel$ > Sophia-Shapiras-MacBook-Pro:**tmp red_angel$ > > > > > So --- what am I missing? What am I doing wrong? I'm pulling my hair out > over this one! Anyone have a clue what's up? I can see that the colon is > present *multiple* times in the string that is meant to be split! How come > PHP's preg_split() function can't see it? > > Thanks, > Sophia > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Shiplu Mokadd.im Follow me, http://twitter.com/shiplu Innovation distinguishes between follower and leader

« previous php.general (#315591) next »