result function use result return result echo result 40

1
2
3
4
$result = function($n) use (&$result) {
return $n ? $n * $result($n - 1) - $n % 2 * 2 + 1: 1;
};
echo $result(40);