Re: regular expressions ?

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

 



to Marek Kilimajer :
	$i='5.';
	if (($i>=1) && ($i<=20) && ($i==(int)$i))
		echo 'yes';

// yes
:'(



On Thu, 27 Jan 2005 16:52:20 +0100, Marek Kilimajer <lists@xxxxxxxxxxxxx> wrote:
> Zouari Fourat wrote:
> > here's the problem :
> > my user MUST input only digits between 1 and 20
> > doing a is_numeric and some comparaison can be bypassed by inputing :
> >
> > .5
> > or
> > 0.5
> > or
> > 5.1
> > or
> > 0.3
> > or
> > .01
> > ...
> > ...
> >
> > so i thought that the smartest way is to use regex
> >
> 
> if( $i >= 1 && $i <= 20 && $i == (int)$i) ...
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[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