foreach遍历数组的顺序

$val1=
<?php
$arr1['laruence'] = 'huixinchen';
$arr1['yahoo']    = 2007;
$arr1['baidu']    = 2008;
foreach ($arr1 as $key => $val1) {
 echo $val1;
//结果是什么?
}
?>
<br>
 
 
$val2=
<?php
$arr2[2] = 'huixinchen';
$arr2[1]  = 2007;
$arr2[0]  = 2008;
foreach ($arr2 as $key => $val2) {
     echo $val2;
//现在结果又是什么?
}
?>
<br>
 
 
$val3=
<?php
$arr3[0] = 'huixinchen';
$arr3[1]  = 2007;
$arr3[2]  = 2008;
foreach ($arr3 as $key => $val3) {
     echo $val3;
//现在结果又是什么?
}
?>

 

通过本实例,可深入理解PHP之数组(遍历顺序)

要完全了解清楚这个问题, 我想首先应该要大家了解PHP数组的内部实现结构………

你可能感兴趣的:(foreach)