PHP7.4新增哪些特性?哪些功能被废弃了?
- 内容介绍
- 文章标签
- 相关推荐
本文共计973个文字,预计阅读时间需要4分钟。
PHP 7.4 新特性发布,新增特性包括:- 可以让我们的代码写得更简洁。
1.属性类型声明
phpclass User{ public int $age; public string $name;}$user=new User();$user->age=某年龄;
PHP7.4 新特性
PHP7.4 上月 28 号已经发布了。又带来了一些新特性。可以让我们的代码写的更少了。
1. 属性添加限定类型
<?php class User { public int $age; public string $name } $user = new User(); $user->age = 10; $user->name = "张三"; //error $user->age = "zhang";//需要传递int
2. 箭头函数
这个特性基本上参考 Js 的 ES6 的语法。可以让我们的代码写的更少。如果你的代码有 fn 这个函数。
本文共计973个文字,预计阅读时间需要4分钟。
PHP 7.4 新特性发布,新增特性包括:- 可以让我们的代码写得更简洁。
1.属性类型声明
phpclass User{ public int $age; public string $name;}$user=new User();$user->age=某年龄;
PHP7.4 新特性
PHP7.4 上月 28 号已经发布了。又带来了一些新特性。可以让我们的代码写的更少了。
1. 属性添加限定类型
<?php class User { public int $age; public string $name } $user = new User(); $user->age = 10; $user->name = "张三"; //error $user->age = "zhang";//需要传递int
2. 箭头函数
这个特性基本上参考 Js 的 ES6 的语法。可以让我们的代码写的更少。如果你的代码有 fn 这个函数。

