PHP Classes

singleton pattern

Recommend this page to a friend!

      PHP Classes blog  >  Why is it better to d...  >  All threads  >  singleton pattern  >  (Un) Subscribe thread alerts  
Subject:singleton pattern
Summary:also it is very usefull singleton for configuration
Author:Daniele Cruciani
Date:2012-03-22 09:00:19
Update:2012-03-22 23:38:27

  1. singleton pattern   Reply   Report abuse  
Daniele Cruciani - 2012-03-22 12:38:03
Configuration or db connect could be implemented with singleton pattern, for example
$cfg = CONFIG::getInstance();
also making a __destruct that write config back in db, and so .. there a lot of clever idiomas that can be implemented with oop

  2. Re: singleton pattern   Reply   Report abuse  
Manuel Lemos - 2012-03-22 23:38:27 - In reply to message 1 from Daniele Cruciani
Right, that is yet another thing about OOP, that despite useful, it was not in the scope of this article.