Short Arrow Function Are Coming to PHP

Share on facebook
Share on google
Share on twitter
Share on linkedin
The new bomb has landed on the PHP community :0 Well I’m just joking, but hopefully, soon we all could start using shorthand arrow function on PHP (similar to Javascript)

$extended = function ($c) use ($callable, $factory) {
    return $callable($factory($c), $c);
// with arrow function:
$extended = fn($c) => $callable($factory($c), $c);

Short Arrow Functions is targeted for inclusion in PHP v7.4, and you can read more about this on the PHP wiki.