PHP & Hex Numbers
| From: | Jonathan Rosenberg | Date: | Mon, 03 Jun 2002 13:07:02 +0000 |
| Subject: | PHP & Hex Numbers | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-100390@lists.php.net to get a copy of this message | ||
I would think that if $a were a number that
echo $a;
and
printf('%d', $a);
would produce the same output. Is this correct?
Either I'm missing something, or PHP gets very confused when
dealing with some numbers. For example, the following program
<?
$result = 0x9E3779B9;
echo $result
printf('%d', $result);
?>
produces
2654435769
-1640531527
I get the same kind of unexpected results when doing arithmetic
on such numbers.
Is this tickling some kind of known bug in PHP? or am I
misunderstanding something?
--
JR