Do something like this…
<?php
$inc=2;
recv(7); // Calling your recursive function i.e. passing the parameter 5 or 7
function recv($v) // Your function definition
{
global $inc;
if($v>=1)
{
echo $inc*$v." ";
$v--;
recv($v); // Function calls itself in other words "recursive call"
}
}
OUTPUT :
14 12 10 8 6 4 2
solved Recursive function for pair of numbers [closed]