Can I include a class inside an method?
php
Solution
Yes, you can definitely do that. In fact, that's exactly what the auto-loading does anyway, since `__autoload()` is itself a function, and you generally use it to look around for your class file to load.
If you manually include your class files like that however, you'll definitely want to use `require_once()` rather than `include()` or `require()`, otherwise you'll get a duplicate declaration of the class.
Problem
Just for the case the autoload thing won't work, I wonder if it's fine with PHP to include a class inside a method? Example: ``` public method doSomething() { include ('MyClass.php'); $foo = MyClass::doAnotherThing(); } ```