I'm currently using output buffering for some sort of header & footer automatization. But I need to access global variables inside the output_callback function. If I don't use class oriented code there isn't any issue. But if I try something like:
class AnotherClass{
public $world = "world";
}
$anotherClass = new AnotherClass();
class TestClass{
function __construct(){
ob_start(array($this,"callback"));
}
function callback($input){
global $anotherClass;
return $input.$anotherClass->world;
}
}
$tClass = new TestClass();
echo "hello";
While the expected output is helloworld it just outputs hello I would really appreciate it if you could provide some sort of fix which lets me access global variables inside the callback function without first setting them as class variables inside the constructor.