3 January 2006
steike.com Php Closures
I thought this was interesting…Read more at steike.com/PhpClosures . Basically, the author is trying to use functions in PHP as a first class entity but PHP’s function scoping doesn’t really allow it, because PHP functions aren’t quite first class.
I suspect this could be expanded a little further and lose the eval() layer, but can’t think of any way offhand to afford PHP closures without some amount of magic. create_function() could probably pull off everything without any eval()s or fatal exceptions for the local function, but I just don’t think it could happen completly natively. Worth thinking about though! And an interesting read, especially if you haven’t worked with a language that supports closures before.

