Forum Moderators: coopster

Message Too Old, No Replies

quick php question

need to determine if $variable is between 2 values

         

gilahacker

10:04 pm on Jan 26, 2005 (gmt 0)

10+ Year Member



ok, is there a quick and dirty way to determine if a variable's value falls between two numbers?

i.e.


if 25<x<30 then
{
dothis
}
else
{
dothat
}

thanks,
-Jason

[edited by: jatar_k at 6:47 am (utc) on Jan. 27, 2005]
[edit reason] no sigs thanks [/edit]

bcolflesh

10:08 pm on Jan 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



if ($x > 25 && $x < 30)

gilahacker

10:28 pm on Jan 26, 2005 (gmt 0)

10+ Year Member



thanks I've got it as

if(($catid>24) && ($catid<30))

and it's working great.

also just found it at onlamp dot com/pub/a/php/2001/04/19/php_foundations.html?page=2

-Jason

[edited by: jatar_k at 6:49 am (utc) on Jan. 27, 2005]
[edit reason] no sigs thanks [/edit]