PHP syntax for dereferencing function result

后端 未结 22 895
不知归路
不知归路 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:52

    Does this work?

     return ($foo->getBarArray())[0];
    

    Otherwise, can you post the getBarArray() function? I don't see why that wouldn't work from what you posted so far.

提交回复
热议问题