Re: How do I convert an array into a mask?
| From: | rija | Date: | Wed, 06 Nov 2002 05:50:55 +0000 |
| Subject: | Re: How do I convert an array into a mask? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-122941@lists.php.net to get a copy of this message | ||
Why don't you ask Jim Carrey ???
He knew more that whoever here about "The MASK" !!!
Good luck.
----- Original Message -----
From: "Daevid Vincent" <daevid@daevid.com>
To: <php-general@lists.php.net>
Sent: Wednesday, November 06, 2002 3:56 PM
Subject: [PHP] How do I convert an array into a mask?
> Does anyone know of a nice efficient way to convert an array of values
> into a "mask"...
>
> Here's the deal. Given an array such that:
>
> $purchitem[0] = 1;
> $purchitem[1] = 3;
> $purchitem[2] = 4;
>
> I want to end up with a variable like this:
>
> $mask = "10110";
>
> Additionally, my theory is that then the person purchases another book
> later
>
> $purchitem[0] = 2;
>
> My new mask should be $purchmask = "01000";
>
> Then I can load their previous mask from the database and boolean OR it
> with the new mask to set the correct permissions. i.e.
>
> $newmask = $mask | $purchmask;
>
> Or ideally = "11110"
>
> Can I boolean OR strings like that in the way I 'hope' it will work? Do
> I need to convert it to an intermediate stage or cast it or anything?
>
> Does this make sense? It's for an online book shopping cart. I have the
> reverse working, where I can split the mask into what books. And I also
> have the $purchitem[] working.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>