How can PHP include statements impact the scope of variables and objects in different files?

When using include statements in PHP, variables and objects defined in the included file are brought into the scope of the including file. This can lead to variable name conflicts or unintended side effects if the same variable names are used in both files. To avoid this issue, it's a good practice to use functions or classes to encapsulate variables and objects, reducing the risk of conflicts.

// file1.php
$variable = "Hello";

// file2.php
include 'file1.php';
echo $variable; // Output: Hello