What is the common mistake made when passing variables between included files in PHP?

The common mistake made when passing variables between included files in PHP is not using the global keyword to access variables defined outside of the included file. To solve this issue, you need to use the global keyword before the variable name in both the parent file and the included file.

// Parent file
$variable = "Hello, world!";

// Included file
function displayVariable() {
    global $variable;
    echo $variable;
}

include 'included_file.php';

displayVariable();