Blogger Information
Blog 32
fans 0
comment 0
visits 19818
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
0417 数组遍历
XuanGG的博客
Original
571 people have browsed it

实例

<?php
$a = [1,2,3,4,5,6,7,8,9,10];
$b = ['name'=>'xuangGG','age'=>'19','xex'=>'男'];

for($i=0;$i<count($a);$i++){
    echo key($a).'=>'.current($a).'<br>';
    next($a);


}
$i=0;
while ($i<count($b)){
    echo key($b).'=>'.current($b).'<br>';
    next($b);
    $i++;

}


echo '<hr style="color: aquamarine">';

echo '<table border="1" cellpadding="4" cellspacing="0" width="60" align="center">';
echo '<caption>'.'信息表'.' </caption>';
echo '<tr>';
echo '<th>name</th><th>age</th><th>xex</th>';
echo '</tr>';
echo '<tr>';
foreach ($b as $value){
    echo "<td>$value</td>";
}

echo '</table>';

运行实例 »

点击 "运行实例" 按钮查看在线实例


Correction status:qualified

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post