I have a file which I include say:
require_once("../../constructor/database.php");
$stuff_inside_include_file->doThis() ; //ACCESSIBLE
function createUser(){
$stuff_inside_include_file->doThat(); //NOT-ACCESSIBLE (object not found)
}
function deleteUser(){
. ...
If I move the require statement into the scope of the function, then it works. Otherwise, it doesn’t. Is there a better solution?
Thank you in advance.
You can try:
it should work, I think.