一、7.2.x改动
1. number_format 返回值
// now outputs string(1) "0" instead of string(2) "-0"
2. get_class()不再允许null。
var_dump(get_class(null))// warning
4. count 作用在不是 Countable Types 将发生warning
count(1), // integers are not countable
5. 不带引号的字符串
在之前不带引号的字符串是不存在的全局常量,转化成他们自身的字符串。现在将会产生waring。
var_dump(HEELLO);
6. __autoload 被废弃
__autoload方法已被废弃
7. each 被废弃
使用此函数遍历时,比普通的 foreach 更慢, 并且给新语法的变化带来实现问题。因此它被废弃了。
8. is_object、gettype修正
is_object 作用在**__PHP_Incomplete_Class** 将反正 true
gettype作用在闭包在将正确返回resource
9. Convert Numeric Keys in Object/Array Casts
把数组转对象的时候,可以访问到整型键的值。
// array to object
$arr = [0 => 1];
$obj = (object)$arr;
var_dump(
$obj,
$obj->{'0'}, // now accessible
$obj->{0} // now accessible
);