PHP loops execute a block of code a specified number of times. There are four (4) types of loops in PHP. The for loop, foreach loop, do while loop and the while loop. In this tutorial, we will be focusing on the while loop which I often used in creating iterations to save code and memory space.
PHP Code for loop
<?php
for($i=1;$i<=10;$i++)
{
echo $i;
}
?>
Output for loop
That would be all. Thank you for visiting and hope this helps you. Feel free to leave a comment below for any questions. I got some other articles related to php in blog and even related to loops.
No comments:
Post a Comment