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.
天蓬老师2018-11-15 22:30:06
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