1<?php
2function display($number) {
3 if($number<=5){
4 echo "$number <br/>";
5 display($number+1);
6 }
7}
8
9display(1);
10?>
1<?php
2function factorial($n)
3{
4 if ($n < 0)
5 return -1; /*Wrong value*/
6 if ($n == 0)
7 return 1; /*Terminating condition*/
8 return ($n * factorial ($n -1));
9}
10
11echo factorial(5);
12?>