3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A {}; $a = new A(); class B {}; $b = new B(); $array = array(); for($i=0; $i<28; $i++) $array[$i] = $a; $array[0] = $array[26] = $b; $array = array_unique($array,SORT_REGULAR); print_r($array);
Output for 7.0.0 - 7.3.1
Array ( [0] => B Object ( ) [1] => A Object ( ) [2] => A Object ( ) [13] => A Object ( ) [26] => B Object ( ) )
Output for 5.2.9 - 5.6.30, hhvm-3.10.1 - 3.22.0
Array ( [0] => B Object ( ) [1] => A Object ( ) [8] => A Object ( ) [14] => A Object ( ) [26] => B Object ( ) )
Output for 4.3.0 - 5.2.8
Warning: Wrong parameter count for array_unique() in /in/sE03m on line 14