finding an array range in PHP -
i have range of values in array like:
$values = array(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0,1.1,1.2,1.3,1.4,1.5);
i need find index of smallest value in array that's greater or equal specified number. example, if user inputs 0.25, need know first array index 2.
in other languages i've used, r, there 'which' function return array of indices meet criteria. i've not found in php, i'm hopeful else has solved this.
thanks.
you can use array_filter
it r does.
Comments
Post a Comment