3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = [ 0 => [ 'one' => 10, 'two' => 20, 'three' => 50, 'four' => 80, 'five' => 100], 1 => [ 'three' => 20, 'five' => 20, 'six' => 100, 'seven' => 10], 2 => [ 'one' => 30, 'three' => 30, 'five' => 10, 'eight' => 10] ]; $combined = []; foreach($input as $array) { foreach($array as $key => $value) { $combined[$key][] = $value; } } $averages = array_map(function($item) { return array_sum($item)/count($item); }, $combined); var_dump($averages);
Output for git.master, git.master_jit, rfc.property-hooks
array(8) { ["one"]=> int(20) ["two"]=> int(20) ["three"]=> float(33.333333333333336) ["four"]=> int(80) ["five"]=> float(43.333333333333336) ["six"]=> int(100) ["seven"]=> int(10) ["eight"]=> int(10) }

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