I read a post here that the person wrote a statement like :
$this->_connection = require_once 'config.php';
// $this->connection is an array variable.
I find it a little bit hard to understand. Am asking myself how can you assign an included file to a variable.
Does it mean that an array must be returned from the "config.php" file? I mean should "config.php" return an array?
Is such statement good in commercial php applications?
Thank you.
The included file may have a return
statement outside of any function. If this happens, the script stops running the included file and the "return value" of the require_once
call is the value of the return
statement.
Docs
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