Categories
PHP Development Web Development

PHP Singleton Pattern

Singleton pattern is used where you need to handle some kind of expensive task – like connection to a database – and you want to be sure that only one instance of an object exists at a time. A very good example of such patter is below: // Example of Singleton Class. class DBConnection { […]