I have this simple singleton class:
public static function getInstance() {
if (!self::$_controller) {
self::$_controller = new self();
}
return self::$_controller;
}
Using PHP 5.3, this code seems to work fine, but on PHP 5.2 it seems like the instance is not returned. I put in a simple debug message like so:
public static function getInstance() {
if (!self::$_controller) {
self::$_controller = new self();
echo "I seem to be working";
}
return self::$_controller;
}
But "I seem to be working" is never echoed out. What's going on here and how can I fix it?