function loop($start,$end) { $x=0; if($start>$end) { echo $x; } else { $x=loop($start++,$end); } echo $x; }