Page 1 of 1

Using ~ before E_NOTICE

Posted: Wed Mar 04, 2009 9:19 am
by mikebr
Been trying to find out why one might use a tilde '~' before E_NOTICE such as:

Code: Select all

error_reporting(E_ALL & ~E_NOTICE);
@ini_set('display_errors', 1);
Searched around the web and in the manual without any joy, If someone could explain the difference of using a ~ or not please?

Thanks in advance

Re: Using ~ before E_NOTICE

Posted: Wed Mar 04, 2009 10:17 am
by VladSun

Re: Using ~ before E_NOTICE

Posted: Wed Mar 04, 2009 10:18 am
by semlar
It's a bitwise operator.. means negation. The ampersand is bitwise AND.

Error reporting is measured in bit values, and negating one basically tells it not to report that type of error.

Ah, you beat me to it, I'll leave this here anyway.

Re: Using ~ before E_NOTICE

Posted: Wed Mar 04, 2009 4:57 pm
by mikebr
Great thanks