Posted By

saturngod on 02/22/11


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

guillermoj88gmailcom


Singleton in PHP


 / Published in: PHP
 

  1. < ?
  2. class SingleTon
  3. {
  4. private static $instance;
  5.  
  6. private function __construct()
  7. {
  8. }
  9.  
  10. public function getInstance() {
  11. if($instance === null) {
  12. $instance = new SingleTon();
  13. }
  14. return $instance;
  15. }
  16. }
  17. ?>

Report this snippet  

You need to login to post a comment.