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