PHP Approves Short Arrow Functions

Short Arrow Functions

The PHP team recently approved the Short Arrow Functions RFC proposed by Nikita Popov, Levi Morrison, and Bob Weinand.

In the RFC it shows this as an example to give you an idea on how it can be used:

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

A Laravel example could look like this:

// Current
$users->map(function($user) {
    return $user->first_name.' '.$user->last_name;

// with arrow function:
// appfinz Technologies 
    fn($user) => $user->first_name.' '.$user->last_name

Tags: website development company in delhi|| website designing company in delhi || b2b portal development company || magento development company in delhi ||  website redesigning company in delhi