3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = new stdClass; $a->id = 2; $b = new stdClass; $b->id = 2; $case1 = array_unique([$a, $b], SORT_REGULAR); $storage = new SplObjectStorage(); $storage->attach($a); $storage->attach($b); $case2 = iterator_to_array($storage); var_dump($case1, $case2);

preferences:
79.42 ms | 406 KiB | 5 Q