3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $array = array(1,1,2,3,4,4,5,6,7,7,8,9,9); $newArray = array(); foreach($array as $key => $value) { if($array[$key] == $array[$key--]) { continue; } else { $newArray[$key] = $value; } echo $value . '<br>'; } print_r($newArray);
Output for 4.3.0 - 7.2.6
Array ( )