|
Posted by friglob on 08/16/06 16:56
amygdala wrote:
> "friglob" <friglob_MAKNI_SVA_VELIKA_SLOVA_I_SVE_CRTICE_@vip.hr> schreef in
> bericht news:ebvgas$ekf$1@news1.xnet.hr...
>
>>i have a string that looks something like this:
>>-1--3--8--22--550--1028-
>>
>>how to make it an array like this:
>>0 => 1,
>>1 => 3,
>>2 => 8,
>>3 => 22,
>>4 => 550,
>>5 => 1028
>>
>>also, i would like to know some good reg exp tutorials, books or whatever
>>that start from basics and that can teach me reg exp
>>
>>
>>Thank you
>
>
> <?php
>
> $string = '-1--3--8--22--550--1028-';
> $array = explode( '--', trim( $string, '-' ) );
> var_dump($array);
>
> ?>
>
> Will do the trick.
>
> Sorry, can't help you with the reg ex. But Google should provide lot's of
> info.
>
>
Just found out...
preg_split("%-%",$string_to_search,-1,PREG_SPLIT_NO_EMPTY);
Thank you for your time.
[Back to original message]
|