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; //print_r($array); $i=1; foreach($arrays as $key=>$values) { echo max($array)." rank is ". $i."\n"; unset($array[$key]); if(!in_array($values,$array)) $i++; }
Output for 4.3.0 - 7.1.0
27 rank is 1 27 rank is 2 27 rank is 3 27 rank is 3 5 rank is 4