T4VN is an online PHP Help community that provides PHP Tutorials, PHP Examples, PHP Scripts, PHP Support
    HOME  |  HOSTING COUPON  |  TEMPLATE  |  PHP SCRIPTS  |  LINK TO US  |  LINK  |  REGISTER | CONTACT
::: Member Login :::
 Username
 Password
 
Forgot your password ?
::: PHP Tutotal :::
  PHP Basic (7)
  PHP Advanced (4)
  PHP Database (2)
  Coding Step By Step (8)
  PHP and AJAX (0)
::: PHP Example :::
  Arrays (1)
  Code Highlighters (3)
  Database Functions (12)
  Date & Time (5)
  E-Mail (6)
  Forms (5)
  Guestbooks (1)
  Logging (2)
  Miscellaneous (10)
  Password Generators (3)
  Randomizers (3)
  String Manipulation (10)
  User Authentication (6)
::: Search On T4VN :::
::: T4VN Statistics :::
  PHP Scripts : 61
  PHP Example : 67
  PHP Tutorials : 21
  PHP News : 93
  Total Coupon : 36
  Other Tutorials :
  Member : 200
  Visitor Online : 2
  Today Visit: 216
  Total Visitor : 229493
  Most Online : 31
::: Sponsored Links :::

PR 4 For This Webpage
Home Today :

Iteration Constructs In PHP


In this tutorials.We teach you "Iteration Contructs In PHP".This Source code has been written by T4VN Team. so, if you want to develop it, please contact us. Thanks for your interested in this code.
Loop in PHP is used to iterate through a section in an application. This is used frequently in many applications.
We will start with a basic loop and then move to adding different requirements to it. Here is the basic syntax for loop.

1- While Loop
+ While loop in PHP is very simple and similar to while loop in C programming.
+ A while statement repeats a loop as long as a specified condition is true.

while (condition is true)
{
// statements to perform
}


Example :

PHP Tutorials :

<?
i
=1;
    while (
i<=12)
         {
         echo 
"This is example for Basic PHP";
         
i=i+1;
     }
?>



2- For Loop

Basic syntax for "For Loop"

for (initialization;condition;increment)
{
//statements to perform
}

Example :

PHP Tutorials :

<?
for($i=1$i<=10$i++){
if(
$i 5){break;}
echo 
$i."<br>";
}
?>



3- do-while LOOP
'do-while' loop is similar to while loop and the only difference here is that the set of statements are executed first and the condition is checked next.
Basic syntax for "Do-While Loop"


do
{
// set of statements that will be executed
}
while(condition)

Example :

PHP Tutorials :

<?
$a
=0;
do
{
    echo
"This is example for Basic PHP";
}while(
$a!=0)
?>



Author : T4VN Team

Other Tutorials
An Introduction to Arrays
Sorting an Array in PHP
Random Title Generator using Arrays
PHP Includes
Date and Time in PHP
Using If Else Statements

::: Resources :::
  Links Directory
  Programming 2 3
  Webmaster 2 3
  Web Design 2 3
  Web Hosting 2 3
  Other Links 2 3
  Asian ShowBiz News
  Teach Seo For You
::: New Templates :::




::: Other Tutorials :::
 Program Design

  Powered By T4VN.NET - Version 2.0 - CopyRight © T4VN.NET 2005-2007