Is it possible to autoload a file based on the namespace in PHP?

Yes, have a look at the example of spl_autoload_register namespace Foobar; class Foo { static public function test($name) { print ''. $name . ''; } } spl_autoload_register(__NAMESPACE__ .'\Foo::test'); // As of PHP 5.3.0 new InexistentClass The above example will output something similar to: Foobar\InexistentClass Fatal error: Class 'Foobar\InexistentClass' not found in Here is a link to a Autoloader builder that is a command line application to automate the process of generating an autoload include file.

Yes, have a look at the example of spl_autoload_register namespace Foobar; class Foo { static public function test($name) { print ''. $name . ''; } } spl_autoload_register(__NAMESPACE__ .'\Foo::test'); // As of PHP 5.3.0 new InexistentClass; The above example will output something similar to: Foobar\InexistentClass Fatal error: Class 'Foobar\InexistentClass' not found in ... Here is a link to a Autoloader builder, that is a command line application to automate the process of generating an autoload include file.

So it seems it's only possible to do with classes. I'll just have to live with that :) – izym Mar 26 '10 at 12:31.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions