title: Calculating sum of two negative binary numbers in php 7.1
body: <p>I'am trying to understand how making an addition of two negative numbers in PHP 7.1. So, I read these questions in stackeoverflow:</p>
  <ul>
  <li><a href="https://stackoverflow.com/questions/4705838/when-should-i-use-a-bitwise-operator">When should I use a bitwise operator?</a></li>
  <li><a href="https://stackoverflow.com/questions/22834377/php-calculating-with-negative-numbers-gives-wrong-values">PHP calculating with negative numbers gives wrong values
  </a></li>
  </ul>
  <p>I tested this script:</p>
  <pre><code>&lt;?php 
   echo (~5) + (~7); // output: -14
  </code></pre>
  <p>But I don't understand why the result is -14. Tying to solve manually, I did like this:</p>
  <pre><code>~5 =&gt; (1011)
  ~7 =&gt; (1001)
  </code></pre>
  <p><code>(1011) + (1001) = 0100 =&gt; 8 != -14 the output of php script</code></p>
  <p>Where is the error?</p>