note 96739 added to language.oop5.overloading

From: Date: Sat, 13 Mar 2010 13:28:55 +0000
Subject: note 96739 added to language.oop5.overloading
Groups: php.notes 
Request: Send a blank email to php-notes+get-166999@lists.php.net to get a copy of this message
Private alternative for my previous Singleton attempt: <?php class Singleton { private static $__instance = null; private function __construct() { } public function __clone() { // throw Exception } /** * Alternative to get rid of the isset-check in __callStatic * * @static * @access public */ public static function setup() { if(!isset(self::$__instance)) { self::$__instance = new self; } else { /** Error */} } public static function __callStatic($name, $arguments) { return call_user_func_array(array(self::$__instance, "__" . $name), $arguments); } /** * All internal * * @access private * @param string $bar */ private function __foo($bar) { echo($bar); } } Singleton::foo("bar"); ?> ---- Server IP: 69.147.83.197 Probable Submitter: 78.54.59.54 ---- Manual Page -- http://www.php.net/manual/en/language.oop5.overloading.php Edit -- https://master.php.net/note/edit/96739 Del: integrated -- https://master.php.net/note/delete/96739/integrated Del: useless -- https://master.php.net/note/delete/96739/useless Del: bad code -- https://master.php.net/note/delete/96739/bad+code Del: spam -- https://master.php.net/note/delete/96739/spam Del: non-english -- https://master.php.net/note/delete/96739/non-english Del: in docs -- https://master.php.net/note/delete/96739/in+docs Del: other reasons-- https://master.php.net/note/delete/96739 Reject -- https://master.php.net/note/reject/96739 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#166999) next »