<?php $factorial = function($n) use (&$factorial) { if ($n == 0) return 1; return $factorial($n - 1) * $n; }; echo $factorial(4); // 1*2*3*4=24 ?>
<?php $factorial = function($n) use (&$factorial) { if ($n == 0) return 1; return $factorial($n - 1) * $n; }; echo $factorial(4); // 1*2*3*4=24 ?>