News Feed
Sections




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

Vance Lucas' Blog:
Practical Uses for PHP 5.3 Closures
October 20, 2010 @ 08:51:47

By now everyone's heard about one of the more powerful and major advancements made in the PHP 5.3.x series of the language - closures. You might have read a description of them and been left wondering what a practical application might be to help drive the point home. Vance Lucas has written up a post to help with just that.

If you're like me, you might be wondering what the practical uses for these new features are before you can rightly justify diving in and using them in new or existing projects. I experimented a lot with closures and possible uses over the past few weeks, and came up with some compelling reasons to start using them.

He's come up with five different examples of how you can use this handy feature:

  • Templating
  • Dynamic Code Extension
  • Delayed Execution
  • Caching
  • Convenience (as in their role in one-off functions for callbacks)

Each of the tips comes with a bit of code (except delayed execution, that's a bit more involved) to help explain the point a bit more.

0 comments voice your opinion now!
closure practical example template dynamic delay cache


blog comments powered by Disqus

Similar Posts

Community Crosstalk: Matthew O'Phinney & Scott Johnson on Dynamic Function/Method Calls

Frikk.tk: How to make your own CAPTCHA protection using PHP

Michael Nitschinger: Benchmarking Cache Transcoders in PHP

Symfony Blog: The "Practical symfony" book is now on sale

Paul Jones: The Difference Between Factories, Registries, and Service Locators


Community Events

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


extension community framework podcast library laravel5 voicesoftheelephpant introduction api series list opinion version php7 wordpress release language laravel unittest interview

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