PHP syntax for dereferencing function result

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

    Write a wrapper function that will accomplish the same. Because of PHP's easy type-casting this can be pretty open-ended:

    function array_value ($array, $key) {
    return $array[$key];
    }
    

提交回复
热议问题