前端之家收集整理的这篇文章主要介绍了
为什么PHP不会抛出“未定义的偏移”通知?,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在运行
PHP 5.5,并且无法让它抛出未定义的补偿
通知.
- $PHP -a
- Interactive mode enabled
-
- PHP > error_reporting(E_ALL);
- PHP > $b = null;
- PHP > var_dump($b['foo']);
- NULL
- PHP > $b = "string";
- PHP > var_dump($b['foo']);
- PHP Warning: Illegal string offset 'foo' in PHP shell code on line 1
- string(1) "s"
- PHP > $b = 345678;
- PHP > var_dump($b['foo']);
- NULL
我做错了什么或者大多数数据类型已经废除了未定义的偏移通知?