I am pulling some data from an XML feed which contains a set of numbers I need to convert to binary.
I'm using this code within a loop to get all the entries
But this keeps returning
XML: 2147483740
Binary: 1111111111111111111111111111111
If I hard code a value in it works
It correctly displays:
XML: 2147483740
Binary: 10000000000000000000000001011100
I think it is something to do with the variable being a certian type of int, anyone have any ideas?
Code:
<item>
<id>183904068</id>
<defindex>5041</defindex>
<inventory>2147483740</inventory>
<quantity>1</quantity>
</item>
<item>
<id>183909469</id>
<defindex>127</defindex>
<inventory>2147483651</inventory>
<quantity>1</quantity>
</item>
I'm using this code within a loop to get all the entries
Code:
<?php
$inventory = $item->inventory;
echo "<strong>XML</strong>: " . $inventory . "<br/>";
echo "<strong>Binary</strong>: " . decbin($inventory);
?>
But this keeps returning
XML: 2147483740
Binary: 1111111111111111111111111111111
If I hard code a value in it works
Code:
decbin(2147483740)
It correctly displays:
XML: 2147483740
Binary: 10000000000000000000000001011100
I think it is something to do with the variable being a certian type of int, anyone have any ideas?