title: Flipping bits in PHP
body: <p>Ok, the problem is :
  You will be given a list of 32-bits unsigned integers in a file to read. You are required to output the list of the unsigned integers you get by flipping bits in its binary representation (i.e. unset bits must be set, and set bits must be unset).</p>
  
  <p>The Sample input is:</p>
  
  <pre><code>3
  2147483647
  1
  0
  </code></pre>
  
  <p>And the sample output is:</p>
  
  <pre><code>2147483648
  4294967294
  4294967295
  </code></pre>
  
  <p>Where the 3 in the input is the number of lines.</p>
  
  <pre><code>&lt;?php
  
  $_fp = fopen("php://stdin", "r");
  /* Enter your code here. Read input from STDIN. Print output to STDOUT */
  $t = fgets($_fp);
  
  
  for($i=0;$i&lt;$t;$i++){
      $line = fgets($_fp);
      $binLine = decbin($line);
      $reverse = strrev($binLine);
      echo bindec($reverse)."\n";
  }
  
  fclose($_fp);
  ?&gt;
  </code></pre>
  
  <p>How is this wrong? And should I be using bitwise operators instead?</p>