Convert Integer to hex values in PHP
<p>How can I convert the numbers in the first class in PHP into the numbers in the second class, is there a built in function to convert the numbers?  Also is my title "
<strong>Convert Integer to hex values</strong>" even correct?</p>

<pre><code>class Permission {
    const READ         = 1;
    const UPDATE       = 2;
    const DELETE       = 4;
    const COMMENT      = 8;
    const GRANT        = 16;
    const UNDELETE     = 32;
    const WHATEVER     = 64;
}
</code></pre>

<p>into this</p>

<pre><code>class Permission {
    const READ     = 0x0001;
    const UPDATE   = 0x0002;
    const DELETE   = 0x0004;
    const COMMENT  = 0x0008;
    const GRANT    = 0x0010;
    const UNDELETE = 0x0020;
    const WHATEVER = 0x0040;
}
</code></pre>

<h2><strong>UPDATE</strong></h2>

<p>To elaborate a little more of what I am trying to do.<br>
 I currently use the first class with a bitmask class for settings,<br>
 somebody suggested to me to change to the format in the second class though.<br>
  However I did not know how they came up with the <strong>0x0020</strong> style numbers from the numbers in my 1st class.  </p>

<p>I now see how to get the <strong>20</strong> from <strong>32</strong> but I do not know how or why they had added <strong>0x00</strong> in front of it to make <strong>0x0020</strong> to replace my original <strong>32</strong></p>
