TzookB

Short Arrow Function Are Coming to PHP

Wed May 08 2019

The new bomb has landed on the PHP community :0 Well Im 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.