This question already has an answer here:
What does "&" mean in '&$var' in PHP? Can someone help me to explain this further. Thank you in advance.
</div>
This question already has an answer here:
What does "&" mean in '&$var' in PHP? Can someone help me to explain this further. Thank you in advance.
</div>
It means pass the variable by reference, rather than passing the value of the variable. This means any changes to that parameter in the preparse_tags function remain when the program flow returns to the calling code.
function passByReference(&$test) {
$test = "Changed!";
}
function passByValue($test) {
$test = "a change here will not affect the original variable";
}
$test = 'Unchanged';
echo $test . PHP_EOL;
passByValue($test);
echo $test . PHP_EOL;
passByReference($test);
echo $test . PHP_EOL;
Output:
Unchanged
Unchanged
Changed!