Does a PHP static anonymous function really work?

后端 未结 2 1311
迷失自我
迷失自我 2021-01-11 09:13

I\'m trying to learn PHP, and now I\'m stuck in \'static anonymous function\'.

I found this in a tutorial (http://www.slideshare.net/melechi/php-53-part-2-lambda-fun

2条回答
  •  感动是毒
    2021-01-11 10:08

    There should be no need to define it with the static keyword.

    paint('red');
    var_dump($callback); // object(Closure)#2 (2) {..}
    var_dump($callback()); // "Painting the house red..."
    

提交回复
热议问题