3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 'visitPoints'=>[ 20=>[2,5,6,8,10,11], 35=>[2,5,6], 57=>[1] ], 'islands'=>[ 20=>[5,10,11], 35=>[5,6] ], 'animals'=>[ 20=>[5,11], 35=>[] ] ]; /*$result = [ 20=>[5,11], 35=>[], 57=>[], ];*/ $result = array_shift($array) ?? []; foreach ($array as $rows) { foreach ($result as $k => $row) { $result[$k] = array_values(array_intersect($row, $rows[$k] ?? [])); } } var_export($result);
Output for git.master_jit, git.master, rfc.property-hooks
array ( 20 => array ( 0 => 5, 1 => 11, ), 35 => array ( ), 57 => array ( ), )

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:
26.45 ms | 405 KiB | 5 Q