3v4l.org

run code in 300+ PHP versions simultaneously
<?php function add() { $list = array(); $prepare = function($value) use(&$prepare, &$list) { if (is_array($value)) { return array_map($prepare, array_merge($list, $value)); } $list[] = $value; }; return false === array_walk(func_get_args(), $prepare, $list) ? 0 : addition(0, $list); } function addition($sum, array &$list) { return empty($list) ? $sum : addition($sum + array_pop($list), $list); } echo add(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: array_walk(): Argument #1 ($array) cannot be passed by reference in /in/cR67D:13 Stack trace: #0 /in/cR67D(20): add(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) #1 {main} thrown in /in/cR67D on line 13
Process exited with code 255.

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