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.
精彩评论