Set permissions in binary
<p>I saw in school a system that set permissions using binary string.</p>

<p>Let's say 101001 = 41</p>

<p>So :  </p>

<ul>
<li>1 can be permission to page 1</li>
<li>2 can be permission to page 2</li>
<li>4 can be permission to page 3</li>
<li>8 can be permission to page 4</li>
<li>16 can be permission to page 5</li>
<li>32 can be permission to page 6</li>
</ul>

<p>So let's say I got the above binary string (101001). I have access to page 1, 4 and 6.</p>

<p>How can I do this in PHP ? Let's say I got a field in MySQL named <code>perms</code> stored in dec so 101001 will be 41. <strong>How  can I know that 41 is equal to 1, 8 and 32 in PHP ?</strong></p>

<p>Thanks.</p>
