PHP syntax for dereferencing function result

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

    This is too far-fetched, but if you really NEED it to be in one line:

    
    return index0( $foo->getBarArray() );
    
    /* ... */
    
    function index0( $some_array )
    {
      return $some_array[0];
    }
    
    

提交回复
热议问题