PHP 新语法 箭头函数
// A collection of Post objects
$posts = [/* … */];
$ids = array_map(fn($post) => $post->id, $posts);
$ids = array_map(function ($post) {
return $post->id;
}, $posts);
关于 LearnKu
推荐文章: