Question

How do you use _autoload in PHP 5.3 with namespaces? I have a main autoload function in a namespace separate from my script. I'm also calling a class with a different namespace. (It's not surprising, but) It's not finding the autoload function. Do I have to recreate the autoload function for each namespace? That seems suboptimal.

Thanks in advance for any help!

Was it helpful?

Solution

From a comment in the PHP manual:

To use autoload function with namespaces you should remember to define it in main scope in "\" namespace.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top