Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在PHP中使用函数作为数组变量_Php_Arrays - Fatal编程技术网

在PHP中使用函数作为数组变量

在PHP中使用函数作为数组变量,php,arrays,Php,Arrays,大多数情况下,当有一个名为func1的函数返回一个数组时,我使用此方法访问该返回数组的特定索引: $myarray=func1(); echo $myarray['AssIndex']; 有没有一种方法可以通过一条线访问它?像这样的 // the brackets are not working. this is only to make my meaning clear. echo {func1}['AssIndex']; 从PHP 5.4开始,您可以执行以下操作: echo func1(

大多数情况下,当有一个名为func1的函数返回一个数组时,我使用此方法访问该返回数组的特定索引:

$myarray=func1();
echo $myarray['AssIndex'];
有没有一种方法可以通过一条线访问它?像这样的

// the brackets are not working. this is only to make my meaning clear.
echo {func1}['AssIndex'];

从PHP 5.4开始,您可以执行以下操作:

echo func1()['AssIndex'];

这被称为。

从PHP 5.4开始,您可以执行以下操作:

echo func1()['AssIndex'];

这就是所谓的。

你真是棒极了,乐根……等等。。。达里传奇!你太棒了,乐根…等等。。。达里传奇!