PHP 7.4.0 发布
PHP 7.4.0 发布了,此版本标志着 PHP 7 系列的第四次特性更新。 PHP 7.4.0 进行了许多改进,并带来了一些新特性,包括: Typed Properties 类型属性 类属性现在支持类型声明,以下示例将强制 $User-> id 只能分配 int 值,而 $User-> name 只能分配 string 值。 <?php class User { public int $id; public string $name; } ?> Arrow Functions 箭头函数 箭头函数提供了用于定义具有隐式按值作用域绑定的函数的简写语法。 <?php $factor = 10; $nums = array_map(fn($n) => $n * $factor, [1, 2, 3, 4]); // $nums = array(10, 20, 30, 40); ?> 将闭包传递给 array_map 或 array_filter 等函数时,它可以发挥极大的作用。 // A collection of Pos...





