|
Posted by wegenern@gmail.com on 08/16/06 17:28
$string = "-1--3--8--22--550--1028-";
if(ereg
("-([0-9]{1})--([0-9]{1})--([0-9]{1})--([0-9]{2})--([0-9]{3})--([0-9]{4})-",
$string, $regs)){
$array_set = array_splice($regs,1);
print_r($regs);
print_r($array_set); // <- This is the output requested.
}
Chung Leong wrote:
> friglob wrote:
> > Just found out...
> >
> > preg_split("%-%",$string_to_search,-1,PREG_SPLIT_NO_EMPTY);
> >
> > Thank you for your time.
>
> preg_split("/-+/", $string_to_search) is a somewhat more orthodox
> solution.
Navigation:
[Reply to this message]
|