GitHub:https://github.com/php/php-src/releases/tag/php-7.0.0
官方文档:http://cn2.php.net/manual/zh/migration70.php
部分列出
类型申明
函数参数、返回值
string
int
float
bool
+ 类名
接口
数组
回调类型
null 合并运算符 ??
如果变量存在且值不为 NULL
, 它就会返回自身的值,否则返回它的第二个操作数。
1 | $a = $_GET['user'] ?? 'default'; |
太空船操作符
当 $a
小于、等于或大于 $b
时它分别返回 -1、0 或 1
1 | echo 1 <=> 1; // 0 |
define
可定义常量数组
use 分组
1 | use some\namespace\{ |