My application generates a random integer from 0 to 1000.
I have 5 ranges: 0-50 , 51-250 , 251-500 , 501-700 , 701-1000 . (Note that range sizes are not equal.)
I will name these ranges: "0", "50", "250", "500", "700", respectively (will store these names in my database).
I know I can do the following:
if ($number > 700 && $number <=1000) $num_range='700'; else if...
... etc.
But is there a more efficient way to do this?
Thank you very much. Relations
source share