Recursive Functions are functions that auto-call themself. Generally, a recursive function returns a value that are passed as argument, so the value is passed from an auto-call to the other, until it is returned.
Recursive functions are very useful in equations with factorial numbers and some operatios with multi-dimensional array.
Factorials are written like 6! and this means: 6 * 5 * 4 * 3 * 2 * 1. So 6! is 4320 and 4! is 24.
In the fallowing example we have a recursive function that finds the factorial of a number "$nr" (here 8).
<?php // this function auto-calls itself (decrementing $nr) until $nr is 0 function factorial($nr) { if($nr > 0) $re = $nr * factorial($nr-1); else if($nr == 0) $re = 1; return $re; } echo '8 factorial is: '. factorial(8); // 8 factorial is: 45360 ?>
<img src="http://coursesweb.net/imgs/webcourses.gif" width="191" height="63" alt="Courses-Web" />
#id { font-style: italic; }
$(document).ready(function() { $(".a_class").click(function(){ $(this).hide("slow"); }); });
function fname($a, $b) { echo $a * $b; }