Make Custom For Loop In Php

We can make a custom loop just like For loop in any programming language. This is for general scripting or programming languages. We can make a custom for loop with the help of recursive function. Just follow the code below.

<?php
function customForLoop($start=10,$stop=30) 
{
	if($start<=$stop)
	{
		echo $start;
		echo "<br>";
		customForLoop($start+1,$stop);
	}
 
 
}
customForLoop(60,70);
?>

Now you will just give the arguments to this custom for loop function that how many times you wan’t it to be run. It will print all the values from the first to the last arguments.