第12课时: 数组的定义和遍历视频教程
<p>掌握PHP中数组遍历的语法结构 示例如下 </p>
<pre>
<code class="language-php">$cars = []; //购物车的数组 遍历
$cars['手机'] = '1000';
$cars['电视'] = '500';
$cars['冰箱'] = '1560';
$cars['洗衣机'] = '2200';
$cars[] = '2200';
$cars[] = '4351';
$cars[] = '543';
foreach($cars as $k => $v){
echo $k . '---' . $v . '<br>';
}</code></pre>
<p> </p>
<p> </p>
查看该视频教程