Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
大多数时候,当有一个名为 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'];
这称为函数数组解引用。