RE: [PHP] Hex operations
sorry... (4FFF | 4) is returning 4 -Original Message- From: Frank S. Kicenko Sent: Thursday, June 20, 2002 7:34 PM To: Martin Towell; [EMAIL PROTECTED] Subject: RE: [PHP] Hex operations I think the goofy variable is getting truncated (3FFF | 4) is returning 7 (4FFF | 4) is returning 8 -Original Message- From: Martin Towell [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 20, 2002 6:37 PM To: Frank S. Kicenko; [EMAIL PROTECTED] Subject: RE: [PHP] Hex operations looks like it's trying to treat $cap1 as a decimal number, and not a hex number have a look at this: for ($cap = 0; $cap < 64; $cap++) { $cap1 = dechex($cap); $bit = ($cap1 | 0x01); echo "$cap - $cap1 - $bit\n"; } and you'll see what I mean... -Original Message- From: Frank S. Kicenko [mailto:[EMAIL PROTECTED]] Sent: Friday, June 21, 2002 9:28 AM To: [EMAIL PROTECTED] Subject: [PHP] Hex operations U... Does anybody know why this doesn't work... Example: $cap = 16383; $cap1 = dechex($cap); // cap1 is now equal to 3FFF; $bit = ($cap1 | 0x01); //bit should equal 3FFF, but it doesn't.. it is always = 3 !! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Hex operations
I think the goofy variable is getting truncated (3FFF | 4) is returning 7 (4FFF | 4) is returning 8 -Original Message- From: Martin Towell [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 20, 2002 6:37 PM To: Frank S. Kicenko; [EMAIL PROTECTED] Subject: RE: [PHP] Hex operations looks like it's trying to treat $cap1 as a decimal number, and not a hex number have a look at this: for ($cap = 0; $cap < 64; $cap++) { $cap1 = dechex($cap); $bit = ($cap1 | 0x01); echo "$cap - $cap1 - $bit\n"; } and you'll see what I mean... -Original Message- From: Frank S. Kicenko [mailto:[EMAIL PROTECTED]] Sent: Friday, June 21, 2002 9:28 AM To: [EMAIL PROTECTED] Subject: [PHP] Hex operations U... Does anybody know why this doesn't work... Example: $cap = 16383; $cap1 = dechex($cap); // cap1 is now equal to 3FFF; $bit = ($cap1 | 0x01); //bit should equal 3FFF, but it doesn't.. it is always = 3 !! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Hex operations
looks like it's trying to treat $cap1 as a decimal number, and not a hex number have a look at this: for ($cap = 0; $cap < 64; $cap++) { $cap1 = dechex($cap); $bit = ($cap1 | 0x01); echo "$cap - $cap1 - $bit\n"; } and you'll see what I mean... -Original Message- From: Frank S. Kicenko [mailto:[EMAIL PROTECTED]] Sent: Friday, June 21, 2002 9:28 AM To: [EMAIL PROTECTED] Subject: [PHP] Hex operations U... Does anybody know why this doesn't work... Example: $cap = 16383; $cap1 = dechex($cap); // cap1 is now equal to 3FFF; $bit = ($cap1 | 0x01); //bit should equal 3FFF, but it doesn't.. it is always = 3 !! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php