RE: [PHP] How do I convert an array into a mask?

2002-11-06 Thread Ford, Mike [LSS]
> -Original Message- > From: Daevid Vincent [mailto:daevid@;daevid.com] > Sent: 06 November 2002 12:23 > To: [EMAIL PROTECTED] > > That's the EASY part John! > > The hard part is converting the array (which was a checkbox > array from a > form submission) into the binary string (as per t

Re: [PHP] How do I convert an array into a mask?

2002-11-06 Thread Tom Rogers
Hi, Wednesday, November 6, 2002, 2:56:33 PM, you wrote: DV> Does anyone know of a nice efficient way to convert an array of values DV> into a "mask"... DV> Here's the deal. Given an array such that: DV> $purchitem[0] = 1; DV> $purchitem[1] = 3; DV> $purchitem[2] = 4; DV> I want to end up with a

RE: [PHP] How do I convert an array into a mask?

2002-11-06 Thread Ernest E Vogelsinger
At 13:43 06.11.2002, Daevid Vincent said: [snip] >Ernest, close but you have it reversed for my needs (i.e. true binary >form). Notice that my LSB is to the left, not right. Ah, ic, you want a <> like "1100101" - that's easy :) Note that I do _not_ pass

RE: [PHP] How do I convert an array into a mask?

2002-11-06 Thread John W. Holmes
> Oooh! I think you're on to something there. Nice! > > Hey, what's the "@" symbol for? I see in the manual the "&" is a > reference (like a pointer in C I assume), but I can't find the "@" > explained. > > > if(@$purchitem[$y] == $x) It'll suppress warnings and errors. If the $purchitem does

RE: [PHP] How do I convert an array into a mask?

2002-11-06 Thread Daevid Vincent
Oooh! I think you're on to something there. Nice! Hey, what's the "@" symbol for? I see in the manual the "&" is a reference (like a pointer in C I assume), but I can't find the "@" explained. > if(@$purchitem[$y] == $x) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit

RE: [PHP] How do I convert an array into a mask?

2002-11-06 Thread Daevid Vincent
everse($charArray); $revString = ""; while ( list($Key, $Val) = each($revchars) ) { $revString .= $Val; } return $revString; } > -Original Message- > From: Ernest E Vogelsinger [mailto:ernest@;vogelsinger.at] > Sent: Wednesday, November 06, 2002 1

RE: [PHP] How do I convert an array into a mask?

2002-11-06 Thread John W. Holmes
> That's the EASY part John! > > The hard part is converting the array (which was a checkbox array from a > form submission) into the binary string (as per the original post) > > > Here's the deal. Given an array such that: > > $purchitem[0] = 1; //purchased book #1 checkbox enabled > > $purchit

RE: [PHP] How do I convert an array into a mask?

2002-11-06 Thread Daevid Vincent
charter.net] > Sent: Wednesday, November 06, 2002 4:19 AM > To: 'Jon Haworth'; [EMAIL PROTECTED] > Subject: RE: [PHP] How do I convert an array into a mask? > > > > Hi John, > > > > > > So given the example below, "10110" > > > >

RE: [PHP] How do I convert an array into a mask?

2002-11-06 Thread John W. Holmes
> 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

RE: [PHP] How do I convert an array into a mask?

2002-11-06 Thread Jon Haworth
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

RE: [PHP] How do I convert an array into a mask?

2002-11-06 Thread John W. Holmes
> 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. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http:

RE: [PHP] How do I convert an array into a mask?

2002-11-06 Thread Ernest E Vogelsinger
At 10:18 06.11.2002, Daevid Vincent said: [snip] >doesn't lend itself nicely to expansion, but may be my only way. I just >have a gut feeling that it can be automated somehow. To turn 1,3,4 into >10110 seems like there is some 'math' there that can work. I al

RE: [PHP] How do I convert an array into a mask?

2002-11-06 Thread Daevid Vincent
Michael, I like your idea, and had I designed this site, I would have the bitmask simmilar to what you suggest. However, I'm a contractor modding an existing/legacy site. Basically the way they have it, is that each user has a field in the db that is simply a string/mask of which books a person has

Re: [PHP] How do I convert an array into a mask?

2002-11-05 Thread Michael Sims
On Tue, 5 Nov 2002 20:56:33 -0800, you wrote: >Does anyone know of a nice efficient way to convert an array of values >into a "mask"... I'm going to assume that you mean a bitmask. I'm not exactly sure what you're trying to accomplish, so I may be off base here, but let me describe how I'm using

Re: [PHP] How do I convert an array into a mask?

2002-11-05 Thread rija
Why don't you ask Jim Carrey ??? He knew more that whoever here about "The MASK" !!! Good luck. - Original Message - From: "Daevid Vincent" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, November 06, 2002 3:56 PM Subject: [PHP]

[PHP] How do I convert an array into a mask?

2002-11-05 Thread Daevid Vincent
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 pers