经常会有人问我, PHP的数组, 如果用foreach来访问, 遍历的顺序是固定的么? 以什么顺序遍历呢? 比如: 复制代码 代码如下: <?php $arr[‘laruence’] = ‘huixinchen’; $arr[‘yahoo’] = 2007; $arr[‘baidu’] = 2008; foreach ($arr as $key => $val) { //结果是什么? } 又比如: 复制代码 代码如下: <?php $arr[2] = ‘huixinchen’; $arr[1] = 2007; $arr[0] = 2008; foreach ($arr as $k