Hello.
I have an array with integers of values from 0 to 100. I wish to remove integers that are less than number X and keep the ones that are equal or greater than number X.
I am using PHP.
Thanks!
Hello.
I have an array with integers of values from 0 to 100. I wish to remove integers that are less than number X and keep the ones that are equal or greater than number X.
I am using PHP.
Thanks!
A little ugly using the clunky create_function
, but straight forward:
$filtered = array_filter($array, create_function('$x', "return $x >= $y;"));
For PHP >= 5.3:
$filtered = array_filter($array, function ($x) { return $x >= $y; });
Set $y
to whatever you want.