3v4l.org

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