Short functions could be coming in PHP 8.1

1 · Amit Merchant · Sept. 28, 2020, 3:26 p.m.
PHP 8 is around the corner and it is coming packed with a lot of new features. But there’s something exciting cooking in PHP 8.1 already. Remember arrow functions which were released way back with PHP 7.4? This is the feature where the following… $numbers = array_map(function($value) use ($factor){ return $value * $factor; }, [1, 2, 3]); …is equivalent to the following. $numbers = array_map(fn($value) => $value * $factor, [1, 2, 3]); This was to make the Closures with only a single express...