<?php //循环普通数组 $arr=array("杭州","成都","拉萨"); $arrlength=count($arr); for($x=0;$x<$arrlength;$x++){ echo $arr[$x]; echo "<br>"; } //循环关联数组 $arr1=array("Peter"=>"35","Ben"=>"37","Joe"=>"43"); foreach ($arr1 as $x=>$x_value){ echo "Key:". $x.", Value=" . $x_value; }