• 实例首页
  • 自学教程
  • IT工具箱
xxxxxxxxxx
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<meta charset="utf-8">
5
<title>PHP array() foreach遍历 实例 - 自学教程(runoops.com)</title>
6
</head>
7
​
8
<body>
9
​
10
    <?php
11
    $age= ["Peter"=>"35","Ben"=>"37","Joe"=>"43"];
12
​
13
    foreach($age as $x=>$x_value){
14
    echo "Key=" . $x . ", Value=" . $x_value;
15
    echo "<br>";
16
    }
17
    ?>
18
​
19
</body>
20
​
21
</html>