2

Please could someone confirm how many parameters are being sent to error_reporting() in the code: error_reporting(E_ALL | E_STRICT);

My assumption is that there is only one parameter which is the result of a bit wise OR of the two constants in the brackets.

I'd just like to be sure that this is not an alternative way to send multiple parameters to a function (i.e. alternative to using ,). Or it's not doing something funky like sending a array containing both constants as a single parameter?

Charles Sprayberry
  • 7,741
  • 3
  • 41
  • 50
tur130
  • 2,043
  • 2
  • 13
  • 8
  • possible duplicate of [Reference - What does this symbol mean in PHP?](http://stackoverflow.com/questions/3737139/reference-what-does-this-symbol-mean-in-php) – mario Feb 19 '12 at 13:22
  • mario - thanks for that link but this is not a duplicate of a question in there. Your link explains bit wise OR, which I already understood. My question is there another significance of the pipe symbol in this context in PHP. Looking at others answers there is not. Thanks everyone... – tur130 Feb 19 '12 at 14:16

2 Answers2

1

You're correct in your first assumption; it's a bitwise OR between E_ALL and E_STRICT. When I run the following code:

echo 'E_ALL: ' . decbin(E_ALL) . '<br>';
echo 'E_STRICT: ' . decbin(E_STRICT) . '<br>';

I get this:

E_ALL: 111011111111111
E_STRICT: 100000000000

Which results in

111111111111111

When bitwise ORed.

Bojangles
  • 99,427
  • 50
  • 170
  • 208
1

My assumption is that there is only one parameter which is the result of a bit wise OR of the two constants in the brackets.

Correct

I'd just like to be sure that this is not an alternative way to send multiple parameters to a function (i.e. alternative to using ,).

Not that I know of :-)

James
  • 3,265
  • 4
  • 22
  • 28