Accessing global variable within static class method
Posted: Sat Nov 21, 2009 7:19 am
I'm trying to do the following but I'm getting a fatal error. Can anyone help?
Cheers!
Code: Select all
<?php
class Boot
{
public function __construct()
{
set_exception_handler('Boot::exception');
$this->doSomeStuff();
}
public function doSomeStuff()
{
throw new Exception('throwing some exception.');
}
public static function exception($e)
{
global $boot;
// $boot = $GLOBALS['boot'];
$boot->printException($e);
}
public function printException($e)
{
echo $e->getMessage();
}
}
$boot = new Boot();
?>