I am needing some information on including files in PHP classes. E.G.
include Foo2.php; //<--- Is this good?
class Foo {
function doFoo(){
include("Foo2.php"); //<--- or is this better?
//do something with vars from Foo2
}
}
I was wondering what the differences were beside scope and if there were any other ways to include another php file in a class.
Thanks in advance for any responses.
include at the global scope. It's much readable and maintainable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With