Abraham Tugalov Abraham Tugalov - 7 months ago 108
PHP Question

What does a single ampersand mean in a PHP conditional statement?

The following code uses a single

in a conditional check. What does the single ampersand mean there?

if( $some_array_or_other_var & SOME_CONSTANT_VARIABLE ){
//do something here

It does not look like a reference, that's what confuses me.

Answer Source

That is a bitwise AND operation: http://www.php.net/manual/en/language.operators.bitwise.php

If, after the bitwise AND, the result is "truthy", the clause will be satisfied.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download