Workaround for binary arithmatic

From: Date: Tue, 31 Jul 2001 11:34:16 +0000
Subject: Workaround for binary arithmatic
Groups: php.general 
Request: Send a blank email to php-general+get-60386@lists.php.net to get a copy of this message
I am looking for a php only workaround to do binary arithmatic on large numbers (ip addresses represented as integer). Works fine for small numbers (smaller than signed long), but ip addresses are unsigned long. The following yeilds incorrect results: echo 2473474821 & 4; The correct answer is NOT 0; I now have to call an external perl program to do the calc. I have a bug logged with php development, but the answer I got is that this will not work till you can have unsigned longs in php. I am using php 4.0.6 Please copy me on replies. TIA -- Richard Ellerbrock richarde@eskom.co.za

« previous php.general (#60386) next »