So I have this user defined function:
function ackermann($n, $m)
{
if ($n == 0)
{
return 1 + $m;
}
if ($m == 0)
{
return ackermann($n - 1, 1);
}
return ackermann($n - 1, ackermann($n, $m - 1));
}
echo ackermann(3, 3);
This should return the value of 61, but it returns this fatal error:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes) in C:\xampp\htdocs\PhpProject1\index.php on line 316
This is only a part of a set of programs that we are tasked to code in PHP since I am taking an introductory subject to PHP. What exactly is the problem?