PHP 4.0 Bug #6678 Updated: Different behaviour of arithmetic operations on Linux PHP and Windows PHP
| From: | waldschrott@php.net | Date: | Sat, 16 Dec 2000 20:52:30 +0000 |
| Subject: | PHP 4.0 Bug #6678 Updated: Different behaviour of arithmetic operations on Linux PHP and Windows PHP | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-41617@lists.php.net to get a copy of this message | ||
ID: 6678
Updated by: waldschrott
Reported By: info@emre.de
Old-Status: Analyzed
Status: Closed
Bug Type: Unknown/Other Function
Assigned To:
Comments:
Previous Comments:
---------------------------------------------------------------------------
[2000-09-12 05:41:28] info@emre.de
<html>
<body>
<?
/* Fuction to turn an integer into an ip address */
function int2ip($int)
{
// There are 4 bytes to handle, so let´s go for it ....
for ($i=0 ; $i < 4 ; $i++) {
// Let´s leave only the first 8 bits, kill the rest and assign the value to an array element
$bytes[$i] = $int & 0xFF;
// Now move the remaining bits to the right and go on with the next byte ...
$int = $int >> 8;
}
// The array containing the bits is joined to a string, the bytes separated by a dot
$ip = "$bytes[3].$bytes[2].$bytes[1].$bytes[0]";
return ($ip);
}
print int2ip(3232235648);
/*
Result should be 192.168.0.128. On WAMP it works fine,
on LAMP it doesn´t.
Maybe this one´s not bug but I´m too dump - still this "wrong" behaviour
has been verfied on several Linux systems running Apache and PHP.
The correct one has been verified on three Windows systems running
Apache and PHP (latest)
*/
?>
</body>
</html>
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=6678