News Feed
Sections




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

Dagfinn Reiersol's Blog:
Real programming with PHP 5.3 (part 4) A more realistic example
June 05, 2009 @ 07:57:21

On the PHP in Action blog Dagfinn Reiersol continues his look at real programming examples using the upcoming PHP 5.3 release. In this new tutorial he focuses on making a classed based on the Range design pattern to paginate results.

A Range object is defined by just two values (three in my variation), so it might seem like too much to have an object just to keep these values, but as you can see from the example, a Range class can have behaviors to change and compare ranges.

He gives two code snippets - the first defines most of the methods of the class in the constructor (using the lambda functions) and the second uses a __call to catch the calls to the same methods but defined normally as private (making them inaccessible to the outside world).

1 comment voice your opinion now!
lambda designpattern range tutorial


blog comments powered by Disqus

Similar Posts

Josh Adell's Blog: Path finding with Neo4j

DevShed: Handling Result Sets and More with PDO Objects in PHP 5

Zend Developer Zone: Dynamically Creating Compressed Zip Archives With PHP

PHPMac.com: Building and Installing Apache 2.2.2 and PHP 5.1.3 (or 5.1.4) on Mac OS X 10.4.6

JSLabs Blog: How to write an image gallery script in PHP


Community Events





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


code language install developer release introduction unittest api refactor podcast list opinion laravel framework symfony2 series testing threedevsandamaybe interview community

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