Notice that now the inner function is returned as the result of MyFunction. You can call MyFunction and store the reference to the inner function in a variable. You can then call the inner function even though the outer function is complete and none of its local variables exist any more. The inner function still has access to the variables that you listed in the use construct.
There are two points to consider here.
The first is that closures aren't as useful in a server side language as they are in a client side language. The reason is simply that closures are useful in callbacks and event handling and server side PHP uses far fewer of both.
The second problem is that $this still isn't treated properly by the inner function. That is you still have to use the $that trick and you still can't access private and protected members.
However anonymous functions do allow you to do a lot of things that would be difficult without them and they are worth knowing about.
You may not find that inner functions or anonymous functions are something that you want to use but you may have them forced upon you. All you have to do is use a framework when you can write modules of some sort that are imported into other functions or classes and you can discover that any functions you do write are inner functions just as the result of how the framework uses them.
PHP is a programming language specifically designed to generate HTML pages but one of the topics that is rarely discussed is exactly how to do this. In this article the idea that HTML generation shoul [ ... ]