加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

PHP list()警告案例

发布时间:2020-12-13 17:16:31 所属栏目:PHP教程 来源:网络整理
导读:阅读list()函数,你可以在notes部分找到这样的警告: Warning list() assigns the values starting with the right-most parameter. If you are using plain variables,you don’t have to worry about this. But if you are using arrays with indices you u
阅读list()函数,你可以在notes部分找到这样的警告:

Warning

list() assigns the values starting with the right-most parameter. If you are using plain variables,you don’t have to worry about this. But if you are using arrays with indices you usually expect the order of the indices in the array the same you wrote in the list() from left to right; which it isn’t. It’s assigned in the reverse order.

任何人都可以在反向订单分配时提供代码示例吗?

解决方法

php> $array = array();

php> list($array[0],$array[1]) = array(1,2)

php> var_dump($array)
array(2) {
  [1] =>
  int(2)
  [0] =>
  int(1)
}

因此[1]在[0]之前分配.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读