Blog Introductions

In this  blog contains tutorials about  HTML Tutorials, Python Tutorials, CSS Tutorials, How to, PHP Tutorials, Java Tutorials, C++ Tutorials, Tutorials,  Examples, Source code,Learning,
Tips and Software development  services. Php Control flow  | Php tutorials Bestitworriors  
    


  Php Control flow 

Php tutorials



Php Control flow  | Php tutorials Bestitworriors - if-else statements,Switch Statements,Else if Statement,Iterative or looping Structure,While Loop,Do-while loop,For loop,Nested loop,Sequential Control Flow Structure,jump statements,Break statement,Continue statement .These ara all control flow in php code.


Some Key Points of Controls Flow


  1. if
  2. if-else statements
  3. Switch Statements
  4. Else if Statement
  5. Iterative or looping Structure
  6. While Loop
  7. Do-while loop
  8. For loop
  9. Nested loop
  10. Sequential Control Flow Structure
  11. jump statements
  12. Break statement
  13. Continue statement

Code



< ?php
echo
"While Loop<br>";
$condation = 1;

while ($condation <= 5) {
echo "The Condation is: $condation <br>";
$condation++;
}

echo
"<br>";
echo
"Do While Loop <br>";
$condation1 = 1;

do
{
echo
"The Condation is: $condation1 <br>";
$condation1 + +;
} while ($condation1 <= 5);

echo
"<br>";
echo
"For Loop<br>";

for ($cond = 0; $cond <= 5; $cond++) {
echo "The Condation is: $cond <br>";
}

echo
"<br>";
echo
"For each Loop<br>";


$months = array("january", "feburary", "march", "april");

foreach($months as $value) {
echo
"$value <br>";
}


echo
"<br>";

// Nester
For
Loop
echo
"<br>";
echo
"Nested For Loop";
for ($j=1;$j < 5;$j++)
{

for ($i = 0; $i < 5; $i++) {

echo "The number is: $i - $j <br>";
}

}
? >


OutPut


While Loop
The Condation is: 1
The Condation is: 2
The Condation is: 3
The Condation is: 4
The Condation is: 5

Do While Loop
The Condation is: 1
The Condation is: 2
The Condation is: 3
The Condation is: 4
The Condation is: 5
For Loop
The Condation is: 0
The Condation is: 1
The Condation is: 2
The Condation is: 3
The Condation is: 4
The Condation is: 5
For each Loop
january
feburary
march
april
Nested For Loop
The number is: 0 - 1
The number is: 1 - 1
The number is: 2 - 1
The number is: 3 - 1
The number is: 4 - 1
The number is: 0 - 2
The number is: 1 - 2
The number is: 2 - 2
The number is: 3 - 2
The number is: 4 - 2
The number is: 0 - 3
The number is: 1 - 3
The number is: 2 - 3
The number is: 3 - 3
The number is: 4 - 3
The number is: 0 - 4
The number is: 1 - 4
The number is: 2 - 4
The number is: 3 - 4
The number is: 4 - 4





I hope You really enjoyed this blog . I try my best to make every thing is easy and helpfull to provide to public .You will get more blog about the Programing project and code . Thanks for visiting my blog if you have any querry related to this you can comment here i will try my best to response you back about Php Control flow  | Php tutorials Bestitworriors