Transfer from: Bo Wang's Weblog
PHP5 in terms of object-oriented strengthening allows us to see the possibility of enterprise applications, many features that cannot be implemented or only don't twist, now I naturally write, the single design pattern requires only one Objects instance, and provide an access point, look at how to implement it in PHP5. Code:
?
Note: Because the constructor is private, it cannot be directly instantiated, and the following method should be used to obtain an example:
$ instance = singleton :: getInstance ();