Welcome Guest, Not a member yet? Register   Sign In
Best Practice for instantiating classes in Libraries that are non-singletons?
#18

[eluser]Jelmer[/eluser]
It's of course your own choice, but I would agree with noctrum. Anyone who knows PHP should be aware of autoloaders. So what's really the difference between this (using load_class):
Code:
load_class('myclass');
$instance = new Myclass();
And this (when the autoloader is used):
Code:
$instance = new Myclass();

It's one line of code that doesn't really add any information. When "new" is used it can only be a class so Myclass() can't be just a function. It doens't tell you where to find the class either.
And if you're afraid someone else doesn't know about autoloaders, you can always add some comments (including the autoload directory).


Messages In This Thread
Best Practice for instantiating classes in Libraries that are non-singletons? - by El Forum - 06-15-2010, 11:04 AM



Theme © iAndrew 2016 - Forum software by © MyBB