3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $obj1 = (object) "hello1"; $obj1->gg = 'world1'; $obj2 = (object) "hello2"; $obj2->gg = 'world1'; $obj3 = (object) "hello3"; $obj3->gg = 'world3'; $arr = array(); $arr[0] = $obj1; $arr[1] = $obj2; $arr[2] = $obj3; $arr = array_map("unserialize", array_unique(array_map("serialize", (array) $arr))); print_r($arr);
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Array ( [0] => stdClass Object ( [scalar] => hello1 [gg] => world1 ) [1] => stdClass Object ( [scalar] => hello2 [gg] => world1 ) [2] => stdClass Object ( [scalar] => hello3 [gg] => world3 ) )