title: PHP Binary to Hex with leading zeros
body: <p>I have the follow code:  </p>
  
  <pre><code>&lt;?
  $binary = "110000000000";
  $hex = dechex(bindec($binary));
  echo $hex;
  ?&gt;
  </code></pre>
  
  <p>Which works fine, and I get a value of c00.</p>
  
  <p>However, when I try to convert 000000010000 I get the value "10".  What I actually want are all the leading zeros, so I can get "010" as the final result.</p>
  
  <p>How do I do this?</p>
  
  <p>EDIT:  I should point out, the length of the binary number can vary.  So $binary might be 00001000 which would result it 08.</p>