• home
  • forum
  • my
  • kt
  • download
  • PHP control structures - do while

    Author: 2008-08-23 12:17:41 From:

    PHP contains a various statement types Conrol structures allow us to manage script to do or not to do anything. When you use do while control structure, script does its job until condition turns false. When you use do while script statement once, always return true. Beginning expression is always true. End of each iteration, PHP evaluates control structure. Main difference from while do, first expression must be return true.

    Let's see it in an example:

    <?php
    $i = 0;
    echo 'This code will run at least once because i default value is 0.<br/>';
    do {
    echo 'i value is ' . $i . ', so code block will run. <br/>';
    ++$i;
    } while ($i < 10);
    ?>

    Happy Coding

    discuss this topic to forum

    relation tutorial

    No relevant information

    Category

      Ad Management (4)
      Calendars (3)
      Chat Systems (7)
      Content Management (6)
      Cookies and Sessions (8)
      Counters (8)
      Database Related (8)
      Date and Time (9)
      Development (6)
      Discussion Boards (7)
      E Commerce (6)
      Email Systems (9)
      Error Handling (5)
      File Manipulation (10)
      Flash and PHP (4)
      Form Processing (7)
      Guestbooks (8)
      Image Manipulation (3)
      Installing PHP (5)
      Introduction to PHP (10)
      Link Indexing (8)
      Mailing List Management (9)
      Miscellaneous (54)
      Networking (8)
      News Publishing (9)
      OOP (24)
      PEAR (6)
      PHP vs Other Languages (2)
      Polls and Voting (6)
      Postcards (1)
      Randomizing (14)
      Redirection (11)
      Searching (9)
      Security (29)
      Site Navigation (16)
      User Authentication (14)
      WAP and WML (7)
      Web Fetching (8)
      Web Traffic Analysis (15)
      XML and PHP (16)

    New

    Hot