3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $array = Array ( "0" => 12 , "1" => 17 , "2" => 5, "3" => 27, "4" => 5 ); //$arrays = $array; $i=1; foreach($array as $key=>$values) { $max = max($array); echo "\n".max($array)." rank is ". $i."\n"; $keys = array_search(max($array), $array); unset($array[$keys]); if(sizeof($array) >0) if(!in_array($max,$array)) $i++; }
Output for 4.3.0 - 7.1.0
27 rank is 1 17 rank is 2 12 rank is 3 5 rank is 4 5 rank is 4