You are here: Re: simple question : regular expressions « PHP Programming Language « IT news, forums, messages
Re: simple question : regular expressions

Posted by amygdala on 08/16/06 16:48

"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.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация