-
Include in class inq
Hello
Questions round class and include:
Is it ok to add include example include('dbconfig') within a class?
At first I thought having includes in a class wasn't the right format but I ran into a tutorial which included include('dbconnect') in a class.
<?php
include('dbconnection'); < -- Can you add includes here ?????
class testclass
{ method1() {}
method2() {}
}
?>
-
Personally I don't see why you can't do this as when you need a dependency for a specific class the only solution is to include it directly before the class or within it, unless someone knows why this is a bad idea I say just go with it.
-