A recursive function is a function that calls itself from within its own code. : Function Recursion « Functions « PHP






A recursive function is a function that calls itself from within its own code.

 
<?php
     function gcd($a, $b) {
          return ($b > 0) ? gcd($b, $a % $b) : $a;
     }
?>
  
  








Related examples in the same category

1.Define recursive function to delete directories
2.Function Recursion Demo
3.Using a recursive function to sum an integer set
4.Recursive Function Example
5.Recursive Functions