3v4l.org

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