PHP快速入门教程:WHILE循环的使用示例

<html>                                                           
                                                                 
<head>                                                           
                                                                 
<title>WHILE循环的使用示例</title>                               
<meta http-equiv=content-type content="text/html; charset=gb2312">
                                                                 
</head>                                                          
                                                                 
<body>                                                           
                                                                 
<h2 align=center >WHILE循环的使用示例</h2>                       
                                                                 
<hr color=red>                                                   
                                                                 
<? //PHP程序开始                                                 
                                                                 
//用来保存各个阶乘                                               
$n=1;                                                            
$i=1;                                                            
/*******************                                             
WHILE循环的使用示例                                              
$i是循环变量                                                     
每次循环时$i自动增1                                              
当$i显示到9的时候结束                                            
********************/                                            
                                                                 
while($i<10)                                                     
  {                                                              
    $n=$n*$i;                                                    
    echo"<h4 align=center >";                                    
    echo$i;                                                      
    echo"!=";                                                    
    echo $n;                                                     
    echo "</h4>/n";                                              
    $i++;                                                        
  }                                                              
                                                                 
//php程序结束                                                    
?>                                                               
                                                                 
</body>                                                          
                                                                 
</html>      
posted @ 2006-11-30 22:01  爱生活,爱编程  阅读(213)  评论(0编辑  收藏  举报