note 62796 added to language.oop5.static

From: Date: Thu, 09 Mar 2006 20:08:33 +0000
Subject: note 62796 added to language.oop5.static
Groups: php.notes 
Request: Send a blank email to php-notes+get-105162@lists.php.net to get a copy of this message
can anyone find the how to fix the bottom? class Logging { static private $instance = false; function __construct() { if (Logging::$instance) { throw new Exception("trying to instantiate a singleton"); } Logging::$instance = $this; } static function instance() { if(!Logging::$instance) { Logging::$instance = new Logging(); } return Logging::$instance; } } $translated = "Logging"; // can be many other things try { return new $translated(); } catch (Exception $e) { echo "$translated is a singleton<br>"; // return Logging::instance(); // works // return $translated::instance(); // doesnt work } ---- Server IP: 64.71.164.2 Probable Submitter: 12.222.159.9 ---- X-Spam-Status: No, hits=3.3 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER, HTML_MESSAGE autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/language.oop5.static.php Edit -- http://master.php.net/note/edit/62796 Del: integrated -- http://master.php.net/note/delete/62796/integrated Del: useless -- http://master.php.net/note/delete/62796/useless Del: bad code -- http://master.php.net/note/delete/62796/bad+code Del: spam -- http://master.php.net/note/delete/62796/spam Del: non-english -- http://master.php.net/note/delete/62796/non-english Del: in docs -- http://master.php.net/note/delete/62796/in+docs Del: other reasons-- http://master.php.net/note/delete/62796 Reject -- http://master.php.net/note/reject/62796 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#105162) next »