How does PHP handle global scope when instantiating objects from strings?

When instantiating objects from strings in PHP, the global scope can be an issue if the class is in a different namespace. To solve this, you can use the fully qualified class name when instantiating the object to ensure it is in the correct namespace.

// Using the fully qualified class name to instantiate the object
$className = '\Namespace\ClassName';
$instance = new $className();