What is the best practice for handling errors related to passing variables by reference in PHP?

When passing variables by reference in PHP, it is important to handle errors by checking if the variable being passed is a reference using the `is_reference()` function. If the variable is not a reference, it should be passed by value instead to avoid potential errors.

function myFunction(&$var) {
    if (!is_reference($var)) {
        $newVar = $var;
        // Do something with $newVar
    } else {
        // Handle passing by reference
    }
}