PHP快速入门教程:for循环

<html>                                                           
                                                                 
<head>                                                           
                                                                 
<title>for循环示例</title>                                
<meta http-equiv=content-type content="text/html; charset=gb2312">
                                                                 
</head>                                                          
                                                                 
<body>                                                           
                                                                 
<h2 align=center >客户端的信息-FOR循环</h2>                     
                                                                 
<hr color=red>                                                   
                                                                 
<!--PHP程序的开始-->                                             
                                                                 
<?                                                               
                                                                 
echo"<table border=1>/n";//显示表格的边框                        
                                                                 
/******************************                                  
用for循环来读取$GLOBALS数组的值                                  
在循环体中显示出客户端的信息                                     
*******************************/                                 
                                                                 
for ($key=reset($GLOBALS);$key=key($GLOBALS);$key=next($GLOBALS))
 {                                                               
  $value=pos($GLOBALS);                                          
  echo "<tr><td>$key</td><td>$value</td></tr>/n";                
 }                                                               
                                                                 
echo "</table>/n";                                               
                                                                 
?>                                                               
                                                                 
<!--PHP程序的结束-->                                             
                                                                 
</body>                                                          
                                                                 
</html>                  
posted @ 2006-11-30 21:55  爱生活,爱编程  阅读(268)  评论(0编辑  收藏  举报