Hi Guys,
I Have some kind of a wired question and i hope you guys can help me with it.🙂
This is the scenario,
I have a function called 'includeFile' which will do nothing but to include another file.
There is an array called $info, outside the function which i like to use inside the included file.
Above can be represent as below,
// main file
<?php
$info = array(1,2,3);
includeFile();
function includeFile()
{
//global $info;
include 'test2.php';
}
//test2.php
print_r($info);
?>
This code works just fine if i un-commented the global $info; line. But i dont want to do it.
assume we cannot touch includeFile() function. assume its a core function.
So how can i write a wrapper around this includefile() function so i can access $info variable inside included file ( test2.php )
I know wired requirement but if anyone of u guys help me with this i really appreciate it.
Thanks,
Best regards,
Niroshan