iklan

✔ How Does Php While Do-While For & Foreach Loops Works???

PHP tutorial for beginners, This lessons will show you how we can use more loops in PHP, How Does PHP While Do-While For & Foreach Loops Works???

Loops in PHP are used to execute the same block of code a specified number of times. PHP supports following four loop types.

  1. FOR − loops through a block of code a specified number of times.
  2. WHILE − loops through a block of code if and as long as a specified condition is true.
  3. DO...WHILE− loops through a block of code once, and then repeats the loop as long as a special condition is true.
  4. FOREACH − loops through a block of code for each element in an array.

Video Tutorial How Does PHP While Do-While For & Foreach Loops Works???



PHP FOR LOOP

<?php   for ($i=0; $i < 10; $i++) {     echo "loops $i </br>";   } ?> 

PHP DO-WILE LOOP

<?php   $a = 0;   do {     echo "Loops $a </br>";     $a++;   } while ($a <= 10);     echo "Loops end"; ?> 

PHP WHILE LOOP

<?php   $a = 0;   while ($a <= 10) {     echo "Loops $a <br>";     $a++;   } ?> 

PHP FOREACH

<?php   $a = array(0,1,2,3,4,5,7,8);   foreach ($a as $key => $value) {     echo "Loops $value <br>";   } ?> 

See you next lessons ...

Sumber http://scqq.blogspot.com

Berlangganan update artikel terbaru via email:

0 Response to "✔ How Does Php While Do-While For & Foreach Loops Works???"

Posting Komentar

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel