Home of web learners


while loop is also very popular and special for its structure

Difference between other loop and while loop is about declaration and increment style as different loop use different style to loop

Lets look an while loop example

$x = 0;
while($x < 5){
echo $x;



Here,we see that $x=0 is iniialization part,but it initial outside of loop structure

Then while loop start,at first it start with condition check

Body part of while loop then start,here we only show the value of x,so we see the increment or change of x value

And in the last,we use increment part by $x++,which is inside body part

while and for loop is same but different in structure as it required sometimes for its structure type for different work


About webn3rd