title: Pack / unpack a 64-bit int on 64-bit architecture in PHP
body: <p>Why do I get the following output on an x64 architecture?</p>
  
  <pre><code>$ php -r 'echo pow(2, 33) . "\n";print_r(unpack("Ivalue", pack("I", pow(2, 33))));'
  8589934592
  Array
  (
      [value] =&gt; 0
  )
  </code></pre>
  
  <p>It seems as though it can handle signed 64-bit ints, but it can't pack / unpack them. According to the documentation, <a href="http://us3.php.net/pack" rel="nofollow noreferrer">http://us3.php.net/pack</a>, the size of I should be machine-dependent, which in this case is 64 bit.</p>
  
  <pre><code>$ php -r 'echo PHP_INT_MAX;'
  9223372036854775807
  
  $ php -v
  PHP 5.2.9 (cli) (built: Apr 17 2009 03:29:14)
  Copyright (c) 1997-2009 The PHP Group
  Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
  </code></pre>