How can the scope of variables be managed effectively when including PHP files within a separate PHP script?

When including PHP files within a separate PHP script, it's important to manage the scope of variables effectively to prevent conflicts or unintended behavior. One way to do this is by using functions to encapsulate variables and prevent them from leaking into the global scope. By defining variables within functions and passing them as parameters when including files, you can ensure that each file operates within its own scope.

// main_script.php

$variable = "Hello";

function include_file($param) {
    include 'included_file.php';
}

include_file($variable);
```

```php
// included_file.php

echo $param; // Output: Hello