what are the benefits of closure, primarily for PHP?

Posted by Patrick on Programmers See other posts from Programmers or by Patrick
Published on 2011-02-01T15:08:32Z Indexed on 2011/02/01 15:32 UTC
Read the original article Hit count: 481

I am beginning the process of moving code over to PHP 5.3 and one of the most highly touted features of PHP 5.3 is the ability to use closures. My understanding of closures is that they allow anonymous functions, can be assigned to variable names, and have interesting scoping abilities.

From my point of view the only seeming benefits in real world applications is the reduction of clutter in the namespace because closures are anonymous.

Am I wrong in this?

Should I be trying to put closures wherever I code?

EDIT:

I have already read this post on Javascript closures.

© Programmers or respective owner

Related posts about php

Related posts about language-features