3v4l.org

run code in 500+ PHP versions simultaneously
<?php $d = [ [1,2,3,4,5], [1,6,7,8,9], [1,5,6,10,11], [6,12,13,14,15] ]; $set = []; foreach($d as $idx => $val){ foreach($val as $v){ $set[ $v ][ $idx ] = true; } } $removedNumbers = []; foreach($d as $idx => $val){ $commonElements = 0; foreach($val as $v){ if(count($set[ $v ]) > 1){ $commonElements++; unset($set[ $v ][ $idx ]); } } if($commonElements > 1){ unset($d[ $idx ]); $removedNumbers = array_merge($removedNumbers, $val); } } print_r($removedNumbers); print_r($d);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 [5] => 1 [6] => 6 [7] => 7 [8] => 8 [9] => 9 ) Array ( [2] => Array ( [0] => 1 [1] => 5 [2] => 6 [3] => 10 [4] => 11 ) [3] => Array ( [0] => 6 [1] => 12 [2] => 13 [3] => 14 [4] => 15 ) )

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:
58.08 ms | 1336 KiB | 4 Q