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, $obj3 ); $array2 = array( $obj1, $obj3, $obj2 ); //$diff1 = array_diff($array1, $array2); $diff2 = array_udiff($array1, $array2, function($a,$b) { if ($a->attr == $b->attr) { return 0; } else { return -1; } }); $diff3 = array_udiff($array1, $array2, function($a,$b) { if ($a->attr == $b->attr) { return 0; } else { return 1; } }); $int = array_intersect($array1, $array2); //var_dump($diff1); var_dump($diff2); var_dump($diff3);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Object of class stdClass could not be converted to string in /in/FFAer:41 Stack trace: #0 /in/FFAer(41): array_intersect(Array, Array) #1 {main} thrown in /in/FFAer on line 41
Process exited with code 255.

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:
50.27 ms | 401 KiB | 8 Q