Loops are used to run the same lines of code for multiple times. If we want to execute same code multiple times then we can put it into a loop block to avoid code repetition. Loop structure includes three sections. These are, Initialization – To initialize the first iteration index of the loop. Conditional execution – For each iteration, it checks whether the specified condition is satisfied. If so, then only the code will be executed. Incrementation/decrementation – After processing each iteration, the loop index should be incremented or decremented to process next iteration. This will be continued till the loop condition is satisfied. PHP supports four types of loop statements. These are, while , do…while , for and foreach . In this tutorial, we are going to see about each of these types of PHP loop statements with an example. I have added a demo with nested for loop to print star triangle. view demo while The following example code shows a while loop with i
Through this blog you will be able to learn multiple Programming languages and you will be able to become a good software developer.We can learn multiple languages with this blog and different type of their utility in the software and website developement