Categories

Related tags

Anonymous Functions and Closures in PHP

22 May 2010

If you are used to switch between JS and PHP programming, it obviously happened to you to miss some of JS flexibility in PHP. I felt it every time when declaring a callback function , being eager to apply something from JS like that:

Whatsoever was it like, since PHP 5.3 that’s not an issue anymore. Of course it’s not a brand-new information, but being a lazy one, I usually study new available features only getting a new version of the language on the production platform. So, to be honest, I discovered availability of closures and anonymous functions in PHP recently. Here is a few examples from php.net :

If you are used to switch between JS and PHP programming, it obviously happened to you to miss some of JS flexibility in PHP. I felt it every time when declaring a callback function , being eager to apply something from JS like that...

Who's the dude?

Dmitry Sheiko is a web-developer living and working in Frankfurt am Main, DE