数组遍历
时间:2006-03-24 来源:freespray
数组遍历
reset($arr);
while(list(,$value)=each($arr))
{
echo "value:$value
";
}
foreach($arr as $value){
echo "value:{$value}";
}
?>
{}可将变量与字符分开
$a=array(4,5,6,2);
foreach($a as $v)
{
echo "$a";
}
?>
foreach($a as $k=>$v){
echo "$a[$k]=>$v";
}
?>
reset($arr);
while(list(,$value)=each($arr))
{
echo "value:$value
";
}
foreach($arr as $value){
echo "value:{$value}";
}
?>
{}可将变量与字符分开
$a=array(4,5,6,2);
foreach($a as $v)
{
echo "$a";
}
?>
foreach($a as $k=>$v){
echo "$a[$k]=>$v";
}
?>
相关阅读 更多 +