PHP program to print the table of a given number using recursion
<?php
//php program to print table of a given number
//using recursion.
function PrintTable($num, $temp)
{
if ($temp <= 10)
{
echo "$num X $temp = " . $num * $temp . "<br>";
PrintTable($num, $temp + 1);
}
}
PrintTable(5, 1);
?>
Output
5 X 1 = 5
5 X 2 = 10
5 X 3 = 15
5 X 4 = 20
5 X 5 = 25
5 X 6 = 30
5 X 7 = 35
5 X 8 = 40
5 X 9 = 45
5 X 10 = 50
