What's the point of E_ALL | E_STRICT if it's the same value as E_ALL?

bobo picture bobo · Oct 28, 2009 · Viewed 8.4k times · Source
  • E_ALL equals 8191 (0001 1111 1111 1111)
  • E_STRICT equals 2048 (0000 1000 0000 0000)

Using bitwise OR to combine them:

1 1111 1111 1111
  1000 0000 0000

We get the exact same value as the original E_ALL:

1 1111 1111 1111

What's the point of doing error_reporting(E_ALL | E_STRICT) if we can simply do error_reporting(E_ALL) to get the same thing?

Answer

cletus picture cletus · Oct 28, 2009

You want:

error_reporting(E_ALL | E_STRICT);

E_ALL does not include E_STRICT (unless you are using PHP 5.4+). Your values are incorrect. From Predefined Constants E_ALL is defined as:

All errors and warnings, as supported, except of level E_STRICT prior to PHP 5.4.

32767 in PHP 5.4.x, 30719 in PHP 5.3.x, 6143 in PHP 5.2.x, 2047 previously