$arr = array(25,41,120,...36);
How to group values in $arr
to specified integer range $start ~ $end
?
For example , if the level range is 1~5(1,2,3,4,5)
, how can I specify a level for each element of $arr
?
The only principle is that larger value should map to larger level, and should cover the entire level range as possible.
UPDATE
I'll give a maybe over simplified example:
if the levels are 1~4
, and the $arr
is array(25,41,120,36)
,then obviously the best way to assign level numbers should be:
25 -> 1
41 -> 3
120 -> 4
36 -> 2