3v4l.org

run code in 300+ PHP versions simultaneously
<?php $obj1 = new stdClass(); $obj1->attr = 'Rod'; $obj2 = new stdClass(); $obj2->attr = 'Jane'; $obj3 = new stdClass(); $obj3->attr = 'Freddy'; $array1 = array( $obj1, $obj2, ); $array2 = array( $obj1, $obj3, ); $diff1 = array_udiff($array1, $array2, function($a,$b) { if ($a->attr == $b->attr) { return 0; } else { return -1; } }); $diff2 = array_udiff($array1, $array2, function($a,$b) { if ($a->attr == $b->attr) { return 0; } else { return 1; } }); var_dump($diff1); var_dump($diff2);
Output for git.master, git.master_jit, rfc.property-hooks
array(1) { [1]=> object(stdClass)#2 (1) { ["attr"]=> string(4) "Jane" } } array(2) { [0]=> object(stdClass)#1 (1) { ["attr"]=> string(3) "Rod" } [1]=> object(stdClass)#2 (1) { ["attr"]=> string(4) "Jane" } }

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
49.97 ms | 401 KiB | 8 Q