3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ['a' => 1, 'b' => 2], ['a' => 2, 'b' => 2] ]; $data = new stdClass(); $data->count = 0; $data->a = 0; $data->b = 0; $cb = function($value, $key, &$data) { $data->count = $data->count + 1; $data->a = $data->a + $value['a']; $data->b = $data->b + $value['b']; }; array_walk($array, $cb, $data); var_dump($data);
Output for git.master, git.master_jit, rfc.property-hooks
Warning: {closure}(): Argument #3 ($data) must be passed by reference, value given in /in/pYepQ on line 19 Warning: {closure}(): Argument #3 ($data) must be passed by reference, value given in /in/pYepQ on line 19 object(stdClass)#1 (3) { ["count"]=> int(2) ["a"]=> int(3) ["b"]=> int(4) }

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