I'm having trouble with this equation in getting it to return the proper value. According to Steam, the equation Steam_community_number = (Last_part_of_steam_id * 2) + 76561197960265728 + Second_to_last_part_of_steam_id
Should return the 64 bit Steam Community ID. Currently, this equation is returning 7.6561198012096E+16
. The equation should be returning 76561198012095632
which in a way is almost the same as what it is already returning. How would I convert the returned E+16 value to the correct value as stated above in my code below? Thanks.
function convertSID($steamid) {
if ($steamid == null) { return false; }
//STEAM_X:Y:Z
//W=Z*2+V+Y
//Z, V, Y
//Steam_community_number = (Last_part_of_steam_id * 2) + 76561197960265728 + Second_to_last_part_of_steam_id
if (strpos($steamid, ":1:")) {
$Y = 1;
} else {
$Y = 0;
}
$Z = substr($steamid, 10);
$Z = (int)$Z;
echo "Z: " . $Z . "</br>";
$cid = ($Z * 2) + 76561197960265728 + $Y;
echo "Equation: (" . $Z . " * 2) + 76561197960265728 + " . $Y . "<br/>";
return (string)$cid;
}
And I am calling this function with $cid = convertSID("STEAM_0:0:25914952");
If you would like to see an example of the output, check here: http://joshua-ferrara.com/hkggateway/sidtester.php