How can the use of include function affect variable passing in PHP?

When using the include function in PHP, variables defined in the parent file are automatically available in the included file. However, changes made to these variables in the included file do not affect the original variables in the parent file. To pass variables by reference and allow changes in the included file to reflect in the parent file, you can use the include_once function with the 'global' keyword before the variable name.

// parent.php
$var = "Hello";
include_once 'included.php';

echo $var; // Output: Hello World

// included.php
global $var;
$var .= " World";