3v4l.org

run code in 300+ PHP versions simultaneously
<?php $all_arrays = [ array(0, 7, 5, 0), array(2, 6, 10, 0), array(4, 8, 15, 10), array(6, 7, 20, 10), array(1, 2, 3, 4), array(5, 6, 7, 8), // more arrays ]; $each_array_count = count($all_arrays[0]); // 4 $all_arrays_count = count($all_arrays); // 6 $output = []; for ($i = 0; $i < $each_array_count; $i++) { for ($j=0; $j < $all_arrays_count; $j++) { $output[$i] += $all_arrays[$j][$i] / $all_arrays_count; } } echo "<pre>"; var_dump($output);
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined array key 0 in /in/E783F on line 20 Warning: Undefined array key 1 in /in/E783F on line 20 Warning: Undefined array key 2 in /in/E783F on line 20 Warning: Undefined array key 3 in /in/E783F on line 20 <pre>array(4) { [0]=> float(3) [1]=> float(6) [2]=> float(10) [3]=> float(5.333333333333333) }

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:
91.4 ms | 406 KiB | 5 Q