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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Nov 4, 2011 at 1:47 PM, Sophia <red_angel@xxxxxxxxxxxxxxx> 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

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux