Php Nested Loops – while foreach do-while continue break statement

Php Nested Loops – while foreach do-while continue break statement

In this Post We Will Explain About is Php Nested Loops – while foreach do-while continue break statement With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to php – Nested Loop, Break Inner Loops and Continue The Main LoopExample

In this post we will show you Best way to implement How to Break the nested loop in PHP, hear for Continue and Break Statement in PHPwith Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

The continue statement:

PHP Loop Example

”;
}
?>

Program – Output:

Value is 1
Value is 2
Value is 4
Value is 5


The break statement :

PHP Loop Example:


Program – Output:

Live 24 u Loop stopped at i = 2


Nested Foreach loop in php :

Syntax:

foreach(array as value)
{
   foreach(array as value)
   {
      Statement;
   }
   Statement;
}

PHP Loop Example:

\n”;
   }
}
?>

Program – Output:

Welcome to pakainfo is A Red CD.
Welcome to pakainfo is A Red Apple.
Welcome to pakainfo is A Red Plum.
Welcome to pakainfo is A blue CD.
Welcome to pakainfo is A blue Apple.
Welcome to pakainfo is A blue Plum.
Welcome to pakainfo is A black CD.
Welcome to pakainfo is A black Apple.
Welcome to pakainfo is A black Plum.


Nested for loop in php :

Syntax:

for ( initialization; your_condition; incdata/decdata )
{
   for ( initialization; your_condition; incdata/decdata )
   {
      statement(s);
   }
   statement(s);
}

PHP Loop Example:

’;
}
?>

Program – Output:

i am devloper i am devloper
i am devloper i am devloper


Nested do while loop in php :

Syntax:

do
{
   statement(s);
   incdata/decdata;
   do
   {
      statement(s);
      incdata/decdata;
   }while( your_condition );
}while( your_condition );

PHP Loop Example:

’;
   $pakainfo++;
}while( $pakainfo < 3 )
?>

Program – Output:

i am devloper i am devloper
i am devloper i am devloper


Nested while loop in php :

Syntax :

while(your_condition)
{
    while(your_condition)
     {
        statement(s);
        incdata/decdata;
     }
    statement(s);
    incdata/decdata;
}

PHP Loop Example:

’;
    $pakainfo++;
}
?>

Program – Output:

i am devloper i am devloper
i am devloper i am devloper

Example

I hope you have Got What is php – Nested Loop, Break Inner Loops and Continue The Main Loop And how it works.I would Like to have FeadBack From My Blog(Pakainfo.com) readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article(Pakainfo.com) Are Most Always Welcome.

Leave a Comment