class foo { private static $_instance; public static function getInstance() { if (is_object(self::$_instance)) { return (self::$_instance); } else { return (self::$_instance = new self); } } private function __construct() {} }