实例首页
自学教程
IT工具箱
源代码
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>PHP array() foreach遍历 实例 - 自学教程(runoops.com)</title> </head> <body> <?php $age= ["Peter"=>"35","Ben"=>"37","Joe"=>"43"]; foreach($age as $x=>$x_value){ echo "Key=" . $x . ", Value=" . $x_value; echo "<br>"; } ?> </body> </html>
运行结果: