How can variable scope be managed when using include in PHP?

When using include in PHP, the included file inherits the variable scope of the file that includes it. To manage variable scope, you can use functions to encapsulate the included code and pass variables as parameters to the function. This way, you can control which variables are accessible within the included file.

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

function includeFile($variable) {
    include "included.php";
}

includeFile($variable);
```

```php
// included.php
echo $variable; // This will output "Hello"