3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = array(1, 2, 3, 4); $array2 = array(1, 2, 5, 6); $array3 = array(1, 2, 6); // The result should contain ONLY: 1 and 2. 6 is not in all 3 results $result = array(); for ($i = 1; $i <= 3; $i++) { $array = 'array' . $i; if (empty($result)) { $result = ${$array}; } else { $inBoth = array_intersect($result, ${$array}); //$notInBoth = array_diff($result, ${$array}); $result = array_diff($result, array_unique(array_merge($result, $inBoth))); } } var_dump($result);
Output for git.master, git.master_jit, rfc.property-hooks
array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(6) }

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