[ create a new paste ] login | about

Link: http://codepad.org/LGpSorAV    [ raw code | output | fork ]

PHP, pasted on Oct 18:
1
2
3
4
5
6
7
8
9
10
11
12
13
<?php

function get_percentile($val){
    $arr = array('300'=>'10', '333'=>'11', '340' => '12'); 
    while(!$arr[$val]){
        $val--;
    }
    return $arr[$val];
}

echo get_percentile(335);

?>


Output:
1
11


Create a new paste based on this one


Comments: