1. I understand the principle of closure through the teacher’s explanation! (The only thing unclear is what it can be written on and what it can be used for)
2. Summary: Closure is a type of anonymous function; it can be written through local variables, function parameters, and function returns. These three methods implement the closure principle respectively.
In PHP, closures are implemented through anonymous functions. The concept of the two is the same.
Closures have many uses and are extremely powerful.
The most commonly used In some cases, it is used as a callback parameter. You can also access local variables in the function through closures outside the function