title: Odd and Even numbers (using & or %)
body: <p>I've always used the following in order to find even and odd numbers:</p>
  
  <pre><code>if(   $num % 2  ) { echo "odd"; }
  if( !($num % 2) ) { echo "even"; }
  </code></pre>
  
  <p>But recently I stumbled upon with the following code that works exactly the same:</p>
  
  <pre><code>if(   $num &amp; 1  ) { echo "odd"; }
  if( !($num &amp; 1) ) { echo "even; }
  </code></pre>
  
  <p>What's the logic behind the "&amp;" in the second method? </p>
  
  <p>I went to check the <a href="http://php.net/manual/en/language.operators.arithmetic.php" rel="nofollow">PHP: Arithmetic Operators</a> and the ampersand is not part of the options.</p>
  
  <p>Thanks.</p>