search

Home  >  Q&A  >  body text

Closure

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.

蓝色海洋117蓝色海洋1172239 days ago1088

reply all(1)I'll reply

  • 天蓬老师

    天蓬老师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

    reply
    0
  • Cancelreply