PHP[013]:fp

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php
function add(...$ints)
{
return $func = function (...$int) use (&$func, &$ints) {
if (count($int) === 0) {
return array_sum($ints);
} else {
$ints = array_merge($int, $ints);
return $func;
}
};
}

$r = add(1, 2, 3)(4)(5)(1, 2, 3, 4, 5)();

echo '结果:' . $r;