PHP 新语法 箭头函数
分享链接:https://stitcher.io/blog/short-closures-in...
// A collection of Post objects
$posts = [/* … */];
$ids = array_map(fn($post) => $post->id, $posts);
$ids = array_map(function ($post) {
return $post->id;
}, $posts);
推荐文章: