Link to home
Start Free TrialLog in
Avatar of kgp43
kgp43Flag for Denmark

asked on

Check if int is between negative and positive values

Hi,

Why does this not work?
($connection_port_top_angle = -370)

if(($_GET["connection_port_top_angle"] >= -360) && ($_GET["connection_port_top_angle"] <= 360)) {

 - This return true..
 - Only allow numbers between -360 and +360
Avatar of Rgonzo1971
Rgonzo1971

HI,

does that work

if($connection_port_top_angle >= -360 && $connection_port_top_angle <= 360)

Regards
You said $connection_port_top_angle = -370, but you're evaluating $_GET["connection_port_top_angle"].
One is a normal variable and the other is an array element.  They are not referring to the same thing.

So why not provide more detail and/or context?
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kgp43

ASKER

Perfect, thanks a lot.
Thanks for the points - great question!