3v4l.org

run code in 300+ PHP versions simultaneously
<?php $intersecting_arrays = Array ( 0 => Array ( 'one' => 10, 'two' => 20, 'three' => 50, 'four' => 80, 'five' => 100 ), 1 => Array ( 'three' => 20, 'five' => 20, 'six' => 100, 'seven' => 10 ), 2 => Array ( 'one' => 30, 'three' => 30, 'five' => 10, 'eight' => 10 ) ); $temp = $intersecting_arrays[0]; for($i = 1; $i < count($intersecting_arrays); $i++) { $temp = array_intersect_key($temp, $intersecting_arrays[$i]); } $result = Array(); foreach(array_keys($temp) as $key => $val) { $value = 0; foreach($intersecting_arrays as $val1) { $value+= $val1[$val]; } $result[$key] = $value / count($intersecting_arrays); } print_r($temp); print_r($result);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [three] => 50 [five] => 100 ) Array ( [0] => 33.333333333333 [1] => 43.333333333333 )

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