What does the error "Only variables can be passed by reference" in PHP indicate, and how can it be resolved?

The error "Only variables can be passed by reference" in PHP indicates that a function is trying to pass a value by reference that is not a variable. To resolve this issue, you can assign the value to a variable before passing it to the function.

$value = 5;
function myFunction(&$var) {
    $var++;
}
myFunction($value);
echo $value; // Output: 6