error_reporting 布尔运算
error_reporting bool operations
在中我找到了两种禁用通知的方法。那么
之间到底有什么区别
error_reporting(E_ALL ^ E_NOTICE);
和
error_reporting(E_ALL & ~E_NOTICE);
?
下面这行是做什么的?
error_reporting((E_ALL | E_STRICT) ^ E_DEPRECATED ^ E_NOTICE );
这会正确报告 E_ALL 和 E_STRICT 而不是 DEPRECATED AND NOTICEs 吗?
var_dump(error_reporting(E_ALL ^ E_NOTICE));
var_dump(error_reporting(E_ALL & ~E_NOTICE));
是同一个int(32759)。只是不同的二进制操作到达那里。
Would this correctly report E_ALL and E_STRICT but not DEPRECATED AND NOTICEs ?
var_dump( decbin ((E_ALL | E_STRICT) ^ E_DEPRECATED ^ E_NOTICE) );
是
101111111110111
111111111111111 E_ALL
000100000000000 E_STRICT
000000000001000 E_NOTICE
010000000000000 E_DEPRECATED
所以答案是肯定的,(E_ALL ^ E_DEPRECATED ^ E_NOTICE)
也是一样的。
在中我找到了两种禁用通知的方法。那么
之间到底有什么区别error_reporting(E_ALL ^ E_NOTICE);
和
error_reporting(E_ALL & ~E_NOTICE);
?
下面这行是做什么的?
error_reporting((E_ALL | E_STRICT) ^ E_DEPRECATED ^ E_NOTICE );
这会正确报告 E_ALL 和 E_STRICT 而不是 DEPRECATED AND NOTICEs 吗?
var_dump(error_reporting(E_ALL ^ E_NOTICE));
var_dump(error_reporting(E_ALL & ~E_NOTICE));
是同一个int(32759)。只是不同的二进制操作到达那里。
Would this correctly report E_ALL and E_STRICT but not DEPRECATED AND NOTICEs ?
var_dump( decbin ((E_ALL | E_STRICT) ^ E_DEPRECATED ^ E_NOTICE) );
是
101111111110111
111111111111111 E_ALL
000100000000000 E_STRICT
000000000001000 E_NOTICE
010000000000000 E_DEPRECATED
所以答案是肯定的,(E_ALL ^ E_DEPRECATED ^ E_NOTICE)
也是一样的。