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

Popular posts from this blog

Line ending issue with Mercurial or Visual Studio -

python - Received unregistered task using Celery with Django -

c# - Delving into the world of XML (Windows Phone) Error I dont understand (The ' ' character, hexadecimal value 0x20, cannot be included in a name.) -