Weedpacket;11032803 wrote:By "grand value" do you mean the "largest"? You want the first element in the array that is larger than the given value (or the first value in the array if there isn't a larger one)?
sort($array);
foreach($array as $value)
{
if($value > $given_value) return $value;
}
return $array[0];
Yes, the same.
Thank you very much
I have to run this way?
$array = array(1,3,5,8,9);
$given_value=6;
sort($array);
foreach($array as $value)
{
if($value > $given_value) return $value;
}
return $array[0];
echo $value;