【发布时间】:2012-11-21 16:44:17
【问题描述】:
我试图了解在设置 error_reporting 值时使用“^”字符和“~”字符之间的区别。例如,我的 php 脚本中有以下内容:
if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
error_reporting(E_ALL & ~ E_DEPRECATED & ~ E_USER_DEPRECATED & ~ E_NOTICE);
} else {
error_reporting(E_ALL ^ E_NOTICE);
}
我已阅读手册页:
http://php.net/manual/en/function.error-reporting.php
但我现在比以往任何时候都更加困惑。是:
error_reporting(E_ALL & ~ E_DEPRECATED & ~ E_USER_DEPRECATED & ~ E_NOTICE);
同:
error_reporting(E_ALL ^ E_DEPRECATED ^ E_USER_DEPRECATED ^ E_NOTICE);
【问题讨论】:
标签: php error-reporting