You are here: Re: Regular expression « PHP Programming Language « IT news, forums, messages
Re: Regular expression

Posted by davranfor on 10/18/07 11:49

On 18 oct, 13:44, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
> On Thu, 18 Oct 2007 10:42:20 +0200, <davran...@gmail.com> wrote:
> > Same but numbers can't be lesser than the previous number, must be
> > equal or greater, is this possible with regex??
>
> > 0-45-90-120 -> Valid
> > 0-45-45-90 -> Valid
> > 0-90-45-120 -> Invalid
>
> Maybe it's possible. I wouldn't do it with a regex anymore though.
>
> function _my_validate($string){
> $array = explode('-',$string);
> if(!is_array($array)) return false;
> $previous = 0;
> foreach($array as $value){
> if(
> intval($value)!= $value
> ||
> $value < $previous
> ||
> $value > 999
> ) return false;
> $previous = $value;
> }
> return true;
>
> }
>
> --
> Rik Wasmus

ok , thanks again

 

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

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