3v4l.org

run code in 300+ PHP versions simultaneously
<?php $one = [ ['id'=>182, 'data'=>'foo'], ['id'=>300, 'data'=>'bar'], ['id'=>8, 'data'=>'baz'], ['id'=>52, 'data'=>'bee'] ]; $two = [52, 300]; $result = array_uintersect($one, $two, function($x, $y) { $x = is_array($x)?$x['id']:$x; $y = is_array($y)?$y['id']:$x; var_dump($x, $y); return $x-$y; }); var_dump($result);
Output for git.master, git.master_jit, rfc.property-hooks
int(182) int(300) int(300) int(8) int(182) int(8) int(300) int(52) int(182) int(52) int(8) int(52) int(52) int(52) int(8) int(8) int(8) int(52) int(52) int(52) int(52) int(182) array(2) { [2]=> array(2) { ["id"]=> int(8) ["data"]=> string(3) "baz" } [3]=> array(2) { ["id"]=> int(52) ["data"]=> string(3) "bee" } }

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