PHP syntax for dereferencing function result

后端 未结 22 1298
不知归路
不知归路 2020-11-22 02:14

Background

In every other programming language I use on a regular basis, it is simple to operate on the return value of a function without declaring

22条回答
  •  南旧
    南旧 (楼主)
    2020-11-22 02:53

    You could use references:

    $ref =& myFunc();
    echo $ref['foo'];
    

    That way, you're not really creating a duplicate of the returned array.

提交回复
热议问题