Use of Closures in Views |
(09-25-2015, 06:46 AM)jLinux Wrote: Question though, are you sure this is a closure? I think its actually an anonymous function. In case I wasn't clear in my previous posts, I didn't differentiate between Closures and anonymous functions in my initial post at least in part from laziness. I don't believe PHP fully supports closures, really has two different types of Closures, nor that Closures are different from anonymous functions in PHP. What PHP has is support for anonymous functions which are represented by a class called Closure, with a language construct (use) which allows the defining environment to copy data into the function's internal scope. Since the anonymous function has access to the calling environment regardless of the arguments passed to the function and can only modify the parent scope if variables passed to the use construct also specify that they are passed by reference, PHP has somehow managed to create something which is almost the opposite of a closure, so, of course, they named it Closure. This shouldn't be completely unexpected in a language which considers "0" (a string containing the character representing the number zero) to be empty and actually gives || a different precedence from OR (which is one of my favorite issues with CodeIgniter's style guidelines). |
Welcome Guest, Not a member yet? Register Sign In |