Simpler range finder?
Posted
by dotty
on Stack Overflow
See other posts from Stack Overflow
or by dotty
Published on 2009-09-17T11:44:51Z
Indexed on
2010/05/12
23:44 UTC
Read the original article
Hit count: 297
Hay guys
I've programmed a very simple range finder.
The user can only select numbers 1 - 180 (axis)
if the number is 90 or below i have to add 90 on to it if the number is 91 - 180 i have to take off 90 from it.
Here's what i have
$min_range = range(1,90);
$max_range = range(91,180);
if(in_array($axis, $min_range)){
$c = $axis + 90;
}elseif(in_array($axis, $max_range)){
$c = $axis - 90;
}
Has anyone got a better solution
© Stack Overflow or respective owner