Are you searching to find the sum of natural numbers up to n using recursion in PHP? Use the below PHP code to find the sum of natural numbers up to n.
* Find the sum of natural numbers up to n.
if ($n <= 1)
return $n + recurSum($n - 1);
$n = 5;
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.