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程序的开始-->                                             
                                                                 
<?                                                               
                                                                 
echo"<table  align=center width=80% border=1>/n";                
/******************************                                  
用while循环来读取$GLOBALS数组的值                                
在循环体中显示出客户端的信息                                     
使用了list函数                                                   
*******************************/                                 
while (list($key, $value) = each($GLOBALS))                      
                                                                 
//注意if结构和strlen函数的使用                                   
  { if (strlen($value)<=50)                                      
    {                                                            
    echo "<tr><td>$key</td>";                                    
    echo "<td>$value</td></tr>/n";                               
    }                                                            
  }                                                              
                                                                 
echo "</table>/n";                                               
                                                                 
?>                                                               
                                                                 
<!--PHP程序的结束-->                                             
                                                                 
</body>                                                          
                                                                 
</html>          
posted @ 2006-11-30 22:00  爱生活,爱编程  阅读(231)  评论(0编辑  收藏  举报