singleton in php?

From: Date: Wed, 04 Sep 2002 11:37:25 +0000
Subject: singleton in php?
Groups: php.lang 
Request: Send a blank email to php-lang+get-376@lists.php.net to get a copy of this message
i want it so i only ever have one object of this class ever in my program. all new instances of the object will simple be references to the first object. how can i implement this? i can do it in java by making the constructor private and then having a static method to return a static variable init to an object of the class if it is not init yet. how can i have a singleton object in php? ASAP via email as well. cheers

« previous php.lang (#376) next »