PHP Loop - php case -

What is Loop

PHP 6 Months 100% Job Assistance Program. for more info... call on 8588829328

use of loop in PHP

When you want the same block of code to run over and over again in a row. Instead of adding several almost equal lines in a script we can use loops to perform a task.


When you want to execute same statements more than one times then use loop.

Four types of Loop used in PHP :

  1. for : In for loop specified condition is predefined.
  2. while : while loop executes the statement while a specified condition is true.

    In while loop first check the condition then execute the statement.

  3. do-while : do – while loop executes the statement once and next statement depends upon a specified condition is true.

    In do – while loop first execute the statement then check the condition, it means if condition is false in that case one time statement execute.

  4. foreach : Foreach loop executes the statement() of an associative array.

Latest Trending Technologies