View Single Post
  #10 (permalink)  
Old 04-18-2008, 03:26 AM
senraj senraj is offline
D-Web Master
 
Join Date: Jul 2007
Posts: 418
senraj is on a distinguished road
Post Re: Operations in PHP

Hi,

while . . . do: This statement keeps repeating specified statements again and again, so long as a particular condition is true. The statements that are repeated should somehow affect the condition. Otherwise, the statement may never become false and the program will go into an infinite loop. Here is an example of a while loop:

PHP Code:
$a 2;
while ( 
$a 100 
{
  echo 
" $a";
  
$a *= $a;
}

$b 1;
while ( 
$b 10 
{
  
$a++;
// OOPS!  This is an infinite loop! 
__________________
Regards,
Senraj.A
Reply With Quote