News Feed
Jobs Feed
Sections




News Archive
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

PHPMaster.com: Sending Email with Swift Mailer

DevShed: Classes as PHP Functions

CorePHP Blog: A Guide to running Apache 2, PHP 4 & PHP 5 on Windows XP

Matthew Weir O'Phinney's Blog: Cgiapp2 Tutorial 1 - Switch Template Plugins at Will

phpPatterns.com: Creating XUL applications with PHP


Community Events









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


unittest opinion testing functional development zendframework2 podcast event example interview code tool api community release composer framework language object introduction

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