> Hi John,
>
> > > So given the example below, "10110"
> > > means that the person can view books 1, 3, and 4,
> > > but not 2 or 5. dig?
> >
> > Explain that to me... I know binary, but I can't see
> > how that equates to 1, 3, and 4.
>
> Because you know binary :-)
>
> The above is a series of yes/no flags, not a binary number. Reading
from
> left to right:
>
> book 1 : yes
> book 2 : no
> book 3 : yes
> book 4 : yes
> book 5 : no
>
> Cheers
> Jon
Ok, so knowing binary and now knowing that, :)
Couldn't you just treat the number as a string and tear it apart to see
what permissions the user has?
<?
$var = "10110";
$l = strlen($var);
for($x=0;$x<$l;$x++)
{
if($var{$x})
{ echo "Permission for book $x is good<br>\n"; }
else
{ echo "Permission for book $x is bad<br>\n"; }
}
?>
---John Holmes...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php