Hi there! What is the means of the single '|' operator in PHP? How can I use this operator? I looked at the php.net, but I couldn't learn info about this operator. I asking the SINGLE (|) operator, NOT THE DOUBLE (||) operator. Thanks.
binary comparison instead of boolean. Same applies to & vs. &&. https://www.php.net/manual/en/language.operators.bitwise.php bitwise if either is true it's true (1), otherwise it's false. 0b0001 | 0b0001 == 0b0001 0b0001 | 0b0000 == 0b0001 0b0000 | 0b0000 == 0b0000 0b0010 | 0b0001 == 0b0011 (3 decimal) Binary and, bitwise both have to be true (1) for a true result, otherwise false (zero) 0b0001 & 0b0001 == 0b0001 0b0001 & 0b0000 == 0b0000 0b0000 & 0b0000 == 0b0000 0b0010 & 0b0001 == 0b0000 There's also xor, where if both are true (1), the result is false (0), otherwise it behaves like single | 0b0001 ^ 0b0001 == 0b0000 0b0001 ^ 0b0000 == 0b0001 0b0000 ^ 0b0000 == 0b0000 0b0010 ^ 0b0001 == 0b0011 XOR is used in bitmap graphics a lot, since it's an easy way to draw a inverse video sprite, that can be undrawn by simply xor'ing the sprite onto the back-buffer. If you're not familiar with binary operations, this probably doesn't make much sense.