3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function sum(float ...$numbers) : float { $intsum = function ($sum, array $numbers) { $number = array_shift($numbers); $sum += $number; return $intsum($numbers, $sum); }; return $intsum(0, $numbers); } echo sum(1, 2, 3, 4); echo PHP_EOL; echo sum(1.5, 2, 3, 4); echo PHP_EOL; try { sum('a', 'b', 'c'); } catch (Error $e) { echo $e->getMessage(); }
based on BPmgq