title: ulong, bitmask and bit shift in PHP from C#
body: <p>Ok so my problem is that I've to "<em>process</em>" a big integer from an endpoint response. This is a <strong>hash</strong> and I've to do some bit mask and bit shifts in order to view this data (it's a version: major, minor, build, etc) in a human readable way.</p>
  
  <p>In <strong>C#</strong> I've easily written few lines to do this <em>processing</em>:</p>
  
  <pre><code>/// Endpoint data
  ulong data = 567454918934921216;
  
  ulong major = (version &amp; 0xFFFF000000000000L) &gt;&gt; 48;
  ulong minor = (version &amp; 0x0000FFFF00000000L) &gt;&gt; 32;
  ulong build = (version &amp; 0x00000000FFFF0000L) &gt;&gt; 16;
  ulong revision = version &amp; 0x000000000000FFFFL;
  
  string human = $"{major}.{minor}.{build}.{revision}";
  Console.WriteLine(human);
  
  /// Returns '2016.318.1322.0'
  </code></pre>
  
  <p>However this should be part of a backend task <strong>running on a server</strong>, so I've to write it in <strong>PHP</strong>. The problem is that PHP handle that big integer (<code>data</code>) as <code>float</code> cutting a significant part of it (and I need <em>every single bit</em> for doing that processing).</p>
  
  <p>&nbsp;</p>
  
  <p>So the question is: <strong>how can I "port" that C# code in <em>normal</em> PHP?</strong></p>
  
  <blockquote>
    <p>Important notice: I cannot access PHP installation or modifiy server
    architecture/configuration. So I can't shift to 64bit to handle bigger
    integer or install plugins.</p>
  </blockquote>