第1关:数组遍历 - 员工信息统计
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
数组遍历结果:
<br>
<?php
$wage = array(
"市场部" => array(
array(1, "杨朝来", "市场经理", 8700),
array(2, "毛华强", "市场专员", 5200),
array(3, "王玲", "市场专员", 5800)
),
"产品部" => array(
array(1, "邓健", "产品经理", 9100),
array(2, "方小琴", "产品专员", 6200),
array(3, "白伟俊", "产品专员", 6300)
),
"账务部" => array(
array(1, "曹晖", "账务经理", 7500),
array(2, "陈炳良", "账务专员", 4800),
array(3, "丁国华", "账务专员", 5000)
)
);
/********** Begin *********/
foreach($wage as $x=>$x_vlue){
echo $x."部门人员如下:";
echo "<br>";
foreach($x_vlue as $low){
foreach($low as $row){
echo $row." ";
}
echo "<br>";
}
}
/********** End *********/
?>
</body>
</html>