I have a class, the method can return an instance of another, ex:
class a { public function foo() { } public function bar() { return new b(); } }
Class "b" is in another file, I can do:
require_once('b.php'); class a { public function foo() { } public function bar() { return new b(); } }
But I am including a class, and this is not use in the mayor of cases. I really do:
class a { public function foo() { } public function bar() { require_once('b.php'); return new b(); } }
In fact, do not use the require function, I use the import function that I need to use, but I do this (and not autoload) for class names (we use packages and do not use namespaces).
This works without error, bullying, notification, etc. Is this wrong?
source share