Posts

Showing posts from February, 2019

What is Loop in Php

Image
What is Loop? Loops are control structures that are used to repeat a given section of a code a certain number of times or till the particular condition is met. Loops in Php are mainly used to execute the same block of code a specific number of times.  Types of Loops For Loop   For Each Loop While Loop  Do while Loop For Loop : For loop is  used to iterate through a sequence or an array of data types or objects. The executions hinge upon a boolean condition(true or false). If the condition is true then the loop continues to execute but if the condition is false then the loop will break. Syntax of For Loop For Each Loop : For each loop as the name suggest that this loop is used to iterate through items of array/collections. Its main function is to iterate through each element of an array.  While Loop : The while loop is  used in executing a block of code if and till the condition expression is true. If the condition expressio...