The Deployer

October 17, 2007

PHP5 Singleton pattern

Filed under: PHP — Lucian Daniliuc @ 07:15
class Singleton {    static private $instance = NULL;

    private function __construct() {    }

    static public function getInstance() {        if (self::$instance == NULL) {            self::$instance = new Singleton();        }        return self::$instance;    }}

(source: http://devzone.zend.com/node/view/id/1714)

1 Comment »

  1. People should read this.

    Comment by Calixte — October 29, 2008 @ 14:12

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress