// Arrow functions were added for PHP 7.4+ $y = 1; // this arrow function: $fn1 = fn($x) => $x + $y; // is equivalent to using $y by value: $fn2 = function ($x) use ($y) { return $x + $y; };