开发者

References in function definitions and parameter definitions

Heya, so I understand how the following should be used:

function test(&$obj) {
    {...}
}

But wha开发者_开发问答t does the following represent?

function &test(&$obj) {
    {...}
}

Any help would be appreciated.


This declaration:

function &test(&$obj)

Represents a function that takes in a reference to a variable as a parameter and returns a variable by reference.


The function will return reference to the variable instead of the value.

See Returning References (PHP manual) for more information.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜