Blogger Information
Blog 19
fans 0
comment 1
visits 10230
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
418作业_数组的遍历与数组函数
陈小伟宝宝的博客
Original
463 people have browsed it

实例

<?php
echo '<p><h4 style="color:blue">请选择你的生日</h4></p>';
echo '<p>
<lable for="name">姓名</table>
<input type="text">
</p>';
$years = range(1990, 2000);
echo '<select name="years">';
foreach ($years as $value) {
	echo '<option>'.$value.'年</option>';
}
echo '</select>';
echo '    ';

$months = range(1, 12);
echo '<select name="months">';
foreach ($months as $value) {
	echo '<option>'.$value.'月</option>';
}
echo '</select>';
echo '    ';

$days = range(1, 30);
echo '<select name="months">';
foreach ($days as $value) {
	echo '<option>'.$value.'日</option>';
}
echo '</select>';
echo '<br>';
echo '<button style="margin-left:100px">提交</button>';

echo '<hr color="red">';
echo( '<br>');
//用用for循环来实现关联数组的遍历
$index = ['id'=>1, 'name'=>'姓名', 'course'=>'php', 'sex'=>'男'];
for ($i=0; $i<count($index); $i++) {
	echo key($index), ':', current($index),'<br>' ;
	next($index);
}


//用while循环来实现
echo '<hr color="red">';
echo( '<br>');
reset($index);
$i = 0;
while ($i<count($index)) {
	echo key($index), ':', current($index),'<br>' ;
	next($index);
}$i++;

运行实例 »

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


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