Ramatou Adamou Issa

Ramatou Adamou Issa

  • Experiences
  • Formation
  • Musics
  • Blog

›Recent Posts

Recent Posts

  • Watchtower, container for updating docker images
  • PHP8 (Migrating existing PHP7 project to PHP8)
  • What news in Symfony 5
  • Command Query Segregation Responsibility (CQRS)
  • AFUP conference feedbacks

PHP News (Sort Closure)

May 3, 2019

Link to the original site [https://stitcher.io/blog/short-closures-in-php]

PHP 7.4 Short Closure

Short closures, also called arrow functions, are a way of writing shorter functions in PHP. This notation is useful when passing closures to functions like

array_map 

or

array_filter.

Current usage

// A collection of Post objects
$posts = [/* … */];

$ids = array_map(fn($post) => $post->id, $posts);

Before

$ids = array_map(function ($post) {
    return $post->id;
}, $posts);

Tweet
Recent Posts
  • PHP 7.4 Short Closure
Ramatou Adamou Issa
Ramatou Adamou Issa
HomeExperiencesFormation
Social Networks
InstagramTwitterChat
Accounts
Gallery photoBlogGitHubStar
Copyright © 2025 Ramazaki