Trying a lot and just failing..
$x = 76561198005785475;
I want to this number, turn into this:
$y = 45519747;
That is the 32bit form of it.
Trying to explain with more details:
http://www.tonymarston.net/php-mysql/converter.php
1) Put the value 76561198005785475 on the “Decimal (input)” field. 2) Press “DEC to BIN” on the “Binary (Base 2)” field. 3) Count 32 starting from the RIGHT and copy it. 4) Paste the 32 chars binary number on “Binary (Base 2)” field. 5) Press “Bin to Dec” button on the “Binary (Base 2)” field.
Ok, now you can see the “45519747” number.
Advertisement
Answer
Try this:
$y = $x & 0xffffffff;
This will truncate your 64-bit value to a 32-bit value, but note that there is absolutely no way to get the 64-bit value back, this is a destructive method.