3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class MyClass { public $prop; public $prop2; } $foo = new MyClass(); $foo->prop = 'test1'; $bar = $foo; $bam = new MyClass(); $bam->prop = 'test2'; $fas = new MyClass(); $fas->prop = 'test2'; $fas->prop2 = 'prop 2 #1'; $test = array($foo, $bar, $bam, $fas); print_r(array_unique($test, SORT_REGULAR));
based on q5KBs
Output for 5.6.30, hhvm-3.18.5 - 3.22.0, 7.0.30 - 7.3.0rc3
Array ( [0] => MyClass Object ( [prop] => test1 [prop2] => ) [2] => MyClass Object ( [prop] => test2 [prop2] => ) [3] => MyClass Object ( [prop] => test2 [prop2] => prop 2 #1 ) )