- Output for 5.3.0 - 5.3.28, 5.4.0 - 5.4.24
- Parse error: syntax error, unexpected '=' in /in/9aXne on line 24
Process exited with code 255.
<?php
namespace Foo\Singleton;
class Singleton {
/**
* The single instance
*/
private static $instance;
/**
* Prevent object creation
*/
private function __construct() {}
private function __clone() {}
/**
* Get Singleton instance
*/
public static function getInstance()
{
if(is_null(self::instance))
{
self::instance = new Singleton;
}
return self::instance;
}
}
$singleton = Singleton::getInstance();