Monday, 30 September 2013

Placing numeric value into an Array range

Placing numeric value into an Array range

I have an array that has numeric values stored. like this:
$ranges = array(1=> '33', 2=> '66', 3=> '99');
i have a variable called $result that gives me a dynamic value between 0-100.
for example:
If $result is equal to or greater than 33 AND less than 66, then the
returned key should be 1
If $result is equal to or greater than 66 AND less than 99, then the
returned key should be 2
If $result is equal to or greater than 99, then the returned key should be 3
Any ideas on how this can be achieved?

No comments:

Post a Comment