Numeric values of error reporting levels

后端 未结 6 646
孤独总比滥情好
孤独总比滥情好 2020-12-24 09:14

I\'m checking the configuration of my PHP server and I need to set the following parameter as follows:

error_reporting set to E_ALL & ~E_NOTICE

6条回答
  •  一向
    一向 (楼主)
    2020-12-24 09:51

    The error flags are power of 2 integers so you can combine them using bit operators. The result is an integer like the one you see so if you set it to E_ALL & ~E_NOTICE it will still end up as integer. What flags comprise the 6135 value depends on your php version. You can check if a flag is contained within it using the bitwise and operator, e.g.

    if ((error_reporting() & E_NOTICE) == E_NOTICE) {
        echo "E_NOTICE is active";
    }
    

提交回复
热议问题