Singleton pattern should I learn it?


I been studying php and loving it. So, basically created a database and had to many several to it to retrieve records for my quiz. It slowed down performance drastically. Literally, was taking 12-15 seconds to refresh the page. It was painfully slow. You get the picture. So, I found the singleton pattern and it increased performance significantly. Now, I wanted to learn everything about singleton patterns,but after a few google searches people were saying it’s bad. I don’t have any real world experience to have enough insight to form my own opinion. Can you some explain to me in layman terms on the pros and cons. The posts on stack overflow went over my head.

When answering the question, can you possibly give me real world examples on how Singleton pattern helped you or did not.


it’s bad when used in the wrong situations but like everything else it is a tool for the belt. it’s not often necessary, but with strict database queries it can help and there isn’t an issue if done correctly.

Sponsor our Newsletter | Privacy Policy | Terms of Service