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 "\n".max($array)." rank is ". $i."\n";print_r($array); $keys = array_search(max($array), $arrays); unset($array[$keys]); if(!in_array(max($array),$array)) $i++; }
Output for 4.3.0 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
27 rank is 1 Array ( [0] => 12 [1] => 17 [2] => 5 [3] => 27 [4] => 5 ) 17 rank is 1 Array ( [0] => 12 [1] => 17 [2] => 5 [4] => 5 ) 12 rank is 1 Array ( [0] => 12 [2] => 5 [4] => 5 ) 5 rank is 1 Array ( [2] => 5 [4] => 5 ) 5 rank is 1 Array ( [4] => 5 )
Output for hhvm-3.10.0

Process exited with code 153.