note 76597 added to language.oop5.patterns
| From: | alexandre at ONLY-HAM-NOT-SPAM dot gaigalas dot net | Date: | Sun, 22 Jul 2007 01:01:58 +0000 |
| Subject: | note 76597 added to language.oop5.patterns | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-128808@lists.php.net to get a copy of this message | ||
A minimalistic singleton implementation I create for my new framework
<?php
class foo
{
static private $i;
private function __construct()
{
echo "I'm alive";
}
static public function singleton()
{
return ((isset(self::$i) || $n = __CLASS__) && self::$i = new $n) ? self::$i : NULL;
}
}
?>
----
Server IP: 200.185.109.13
Probable Submitter: 201.74.19.147
----
Manual Page -- http://www.php.net/manual/en/language.oop5.patterns.php
Edit -- https://master.php.net/note/edit/76597
Del: integrated -- https://master.php.net/note/delete/76597/integrated
Del: useless -- https://master.php.net/note/delete/76597/useless
Del: bad code -- https://master.php.net/note/delete/76597/bad+code
Del: spam -- https://master.php.net/note/delete/76597/spam
Del: non-english -- https://master.php.net/note/delete/76597/non-english
Del: in docs -- https://master.php.net/note/delete/76597/in+docs
Del: other reasons-- https://master.php.net/note/delete/76597
Reject -- https://master.php.net/note/reject/76597
Search -- https://master.php.net/manage/user-notes.php