Rewriting an anonymous function in php 7.4
问题 There is the following anonymous recursive function: $f = function($n) use (&$f) { return ($n == 1) ? 1 : $n * $f($n - 1); }; echo $f(5); // 120 I try to rewrite to version 7.4, but there is an error, please tell me what I'm missing? $f = fn($n) => ($n == 1) ? 1 : $n * $f($n - 1); echo $f(5); Notice: Undefined variable: f Fatal error: Uncaught Error: Function name must be a string 回答1: Just like Barmar said, you can't use $f from the outside scope, because when the implicit binding takes