Umm..
$static=bindec('10100000');
$dynamic=bindec('10110000');
# Can't think right now, but it seems like
# you can just do this instead: $dynamic & ~$static
if(($static|$dynamic)& ~$static)
{
# Don't throw flag
}
else
{
# Throw flag
}
It throws a flag, if all 1's in the dynamic string has a match in the static
one, but not if the static one has a 1 that the other doesn't have..
Correct?
--
// DvDmanDT
MSN: dvdmandt�hotmail.com
Mail: dvdmandt�telia.com
"Ron Herhuth" <[EMAIL PROTECTED]> skrev i meddelandet
news:[EMAIL PROTECTED]
I may be just over thinking this but I'm stuck trying to figure out a
solution that has to deal with comparing a series of dynamic strings to a
known string. The strings will be 8 characters long and each character
will be either a zero or a 1. What I need to do is to compare the dynamic
strings with the known and if each of the 1 characters in the dynamic
string aligns with the 1 characters in the known string it will throw a
flag. The dynamic string does NOT need to contain all of the 1 characters
that the known string does, just that the ones that it contains align.
Examples:
Known:
10100010
Dynamic:
00100000 Throws flag because both strings contain a 1 in position 3
01100000 Doesn't throw flag because there is a 1 in position 2
10100000 Throws a flag because the 1s in position 1 and 3 align
10110000 Doesn't throw a flag because of the 1 in position 4
I was able to create a function that matches the entire string but I lost
it when trying to deal with partial matches. Does anyone have a potential
solution for such a beast? I appreciate any input you might be able to
offer...
Thanks,
Ron
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php