Home of web learners


loop is used to execute a script within a condition and if the condition not false at one time,if we use iterative things,then loop happens.

A loop can also loop one times or thousands times but within loop

PHP have 4 loop type

1.For loop

2.while loop

3.Do while loop

4.For each loop

To start about loop,you have to some things from loop

A loop have three things,its commond in every type of loop

They are:

1.Initialization:From where to start a loop,like you want to say somebody to say number from 1 to 50,so you can also ask to say number from 30 to 50,so here you see the start 1 or 30,so initialization is from where to start,its start with assigning variable data

2.Condition:You say somebody to say number from 30 to 50,so when 50 comes he stops,its the condition,that you have to count up to 50,in programming it used relational operator to do that,like ==

3.Increment/Decrement:Its the thing,that you add with your initial variable,like you say somebody to say odd number from 1 to 20,then he say 1,3,5 so you see that difference is 2,its the increment here,increment every times 2 with the previous value.

Increment means increase data with previous data and decrement means decrease,making value less than previous data

Increment can happen like use add with previous data or multiply with previous data,whatever the way but increase value

Decrement is reverse of increment


About webn3rd