What's the difference between if( $x=1 || $y=1) and if( $x=1 | $y=1) in PHP

html, php

Solution

`||` and `&&` are boolean operators, they take 2 arguments, convert each to a boolean, then return `true` or `false`.

`|` and `&` are bitwise operators. They convert their arguments to binary and compare each bit. They return a binary number.

Problem

Possible Duplicate: Reference - What does this symbol mean in PHP? Whats the difference between these two in php? ``` if( $x==1 || $y==1) if( $x==1 && $y==1) ``` vs. (respectively) ``` if( $x==1 | $y==1) if( $x==1 & $y==1) ``` To my knowledge they both work the same | vs. || in php. But there has to be a difference!!!

Original source

Related problems