foreach的应用~
<?php
/**
* QQ:5871029 Email:hel8@vip.qq.com
* @copyright Horleun (c)2010
* @author Horleun <Horleun@foxmail.com>
*/
$a=array(“5″,”8″,”7″,”1″,”0″,”2″,”9″);
print_r($a);
echo”<br />”;
foreach($a as $value)
{
echo “\$a的当前值为:$value!<br />”;
}/*带下标*/
$i=1;
foreach($a as $v)
{
echo”\$a[$i]的值为:$v.<br />”;
$i++;
}/**/
foreach($a as $b=> $v)
{
echo”\$a[$b]=$v<br />”;
}/*多维数组应用*/
$c[0][0]=”My”;
$c[0][1]=” is”;
$c[1][0]=” Horleun”;
$c[1][1]=”.<br />”;
foreach($c as $v1)
{
foreach($v1 as $v2)
{
echo”$v2″;
}
}
?>
结果: