【问题标题】:How to make this array assignment work in php5.6?如何使这个数组分配在 php5.6 中工作?
【发布时间】:2021-07-06 18:00:38
【问题描述】:

我有一段代码,是用php7写的:

[$columns, $values, $conditions] = $this->gatherConditions($identifier);

$identifier 是一个数组。当我在 php5.6 服务器上运行此代码时,它显示错误 - unexpected "=" on line X。在 php 5.6 中应该如何编写这行代码?

【问题讨论】:

    标签: arrays php-7 php-5.6


    【解决方案1】:

    在 PHP 7.1 中允许使用短数组语法列表解构之前,PHP 中的等效项是

    list($columns, $values, $conditions) = $this->gatherConditions($identifier);

    查看 php.net/list 页面:https://www.php.net/manual/en/function.list.php

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-30
      • 1970-01-01
      • 2020-12-30
      • 1970-01-01
      相关资源
      最近更新 更多