Heya, so I understand how the following should be used:
function test(&$obj) {
{...}
}
But what does the following represent?
function &test(&$obj) {
{...}
}
Any help would be appreciated.
Heya, so I understand how the following should be used:
function test(&$obj) {
{...}
}
But what 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.