php - `!(error_reporting() & $errorcode)`(PHP)是做什么的?

标签 php error-handling

我正在尝试编写自己的错误报告功能。作为模板,我使用的示例包含以下代码片段:

if (!(error_reporting() & $errorcode)) {
    return;
}

但是它到底是做什么的呢?我不明白error_reporting()$errorcode之间的“&”号(errorcode是一个函数参数)。
我试图输出error_reporting(),我得到了(似乎被称为多个):
int(32767)
Unknown errortype: [8] Undefined variable: kj
int(0)
int(0)
int(0)
int(0)
int(0)
int(0)
int(0)
int(0)

然后我在php.net上搜索,发现32767是错误E_ALL,但它在错误代码的下面一行显示8,这是E_NOTICE -error ?!
我不知所措,我无法理解。有人能够详细解释此行为吗?

最佳答案

如果明确禁用错误报告,则此块将立即返回。您不希望在创建禁用错误报告的代码时调用错误报告。

关于php - `!(error_reporting() & $errorcode)`(PHP)是做什么的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41461540/

相关文章:

javascript - Node.js v12.x 如何设置 Error.code 属性?

php - 检查 SQL 数据库是否存在值,如果存在则返回值

php - 使用 jquery 动态内部文本的数字总和

node.js - 一个迁移文件中的多个迁移语句

wpf - 如何处理用户控件中的意外异常

vue.js - Vue JS如何全局捕获错误并将其显示在顶级组件中

facebook-graph-api - PHP :No node specified thrown in base_facebook.php

php - 继承问题: calling parent construct function in subclass

php - 使用 Zend_Mail 获取邮件源

php - Openshift MYSQL Cartige IP