What does this ~ operator mean here?

前端 未结 5 1909
清酒与你
清酒与你 2020-12-06 10:54

Example:

set_error_handler(array($this, \'handleError\'), E_ALL & ~E_STRICT & ~E_WARNING & ~E_NOTICE);

what does that suppose t

5条回答
  •  不知归路
    2020-12-06 11:18

    It is the bitwise not operator (also called "complement"). That is the bits set in ~ $a are those that are not set in $a.

    So then

    E_ALL & ~E_STRICT & ~E_WARNING & ~E_NOTICE
    

    is the bits set in E_ALL and those not set in E_STRICT, E_WARNING and E_NOTICE. This basically says all errors except strict, warning and notice errors.

提交回复
热议问题