3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function sum() { $list = array(); $prepare = function($value) use(&$prepare, &$list) { if (is_array($value)) { return array_walk($value, $prepare, $list); } else { $list[] = $value; } }; $args = func_get_args(); array_walk($args, $prepare, $list); return addition(0, $list); } function addition($sum, array &$list) { return empty($list) ? $sum : addition($sum + array_pop($list), $list); } $vars = range(1, 10); echo sum($vars, array($vars, $vars));
based on rkmEN
Output for 5.3.17 - 7.2.0
165