News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

PHPRiot.com:
Singleton Classes in PHP
March 22, 2010 @ 08:11:19

On PHPRiot.com today there's a new tutorial teaching you about singleton classes in PHP and how they can be used to simplify things in your application.

In this PhpRiot Snippet I will show you how to create and use singleton classes. A singleton class is a class that can instantiated once only. While it may not come up frequently, it can be a useful technique when it simply doesn't make sense to have than one instance of a class.

He shows how, by following a few rules, you can make a sample class that will only create and pass back a new instance of itself if ones doesn't already exist. It's a simple concept, but it can come in quite handy in the right situations. Just be sure you use them wisely.

0 comments voice your opinion now!
singleton class tutorial


blog comments powered by Disqus

Similar Posts

Script-Tutorials.com: Autocomplete with PHP, jQuery, MySQL and XML

Zend Developer Zone: PHP and IBM Goodness

NetTuts.com: Expressive Tests with Hamcrest

The Bakery: Four New Articles - Load Balancing, Request Info, UUID Behavior & Upload Thumbnails

Till Klampaeckel's Blog: Cooking PHPUnit (and a chef-solo example on top)


Community Events





Don't see your event here?
Let us know!


language opinion library conference introduction laravel security list release podcast voicesoftheelephpant composer community artisanfiles symfony interview tool series version framework

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework