What does the "&" symbol do when used in a PHP function declaration?
When the "&" symbol is used in a PHP function declaration, it signifies that the parameter is being passed by reference rather than by value. This means that any changes made to the parameter within the function will also affect the original variable outside of the function. This can be useful when you want to modify the original variable directly within the function. Example:
function increment(&$num) {
$num++;
}
$value = 5;
increment($value);
echo $value; // Output will be 6