I’ve written and played around with alot of PHP function and variables where the original author has written the original code and I’ve had to continue on developing the product ie. Joomla Components/Modules/Plugins and I’ve always come up with this question:
How does the ‘&’ symbol attached to a function or a variable affect the outcome?
For instance:
$variable1 =& $variable2;
OR
function &usethisfunction() {
}
OR
function usethisfunction(&thisvariable) {
{
I’ve tried searching through the PHP manual and other related sources but cannot find anything that specifically addresses my question.
These are known as references.
Here is an example of some “regular” PHP code:
And this is what you can achieve using references:
The nitty gritty details are in the documentation. Essentially, however: