views:

983

answers:

1

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!

+5  A: 

From a comment in the PHP manual:

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

VoteyDisciple
Well, that was simple. Works like a charm.Thanks! I'd vote the answer up, but I don't have enough reputation yet.
M3Mania
@M3Mania, you can mark the answer as accepted. There's a little check image right below the down-vote arrow.
Ionuț G. Stan
Thank you! I love this site.
M3Mania