Quote:
Originally Posted by Neuro Toxin
This is what I use...
PHP Code:
function CommunityID2SteamID($communityid)
{
$steamid = 'STEAM_1:';
$z = ($communityid - 76561197960265728) / 2;
if ($z - floor($z) == 0.5)
$steamid.='1:';
else
$steamid.='0:';
$steamid.=floor($z);
return $steamid;
}
function SteamID2CommunityID($steamid)
{
$parts = explode(':', str_replace('STEAM_', '' ,$steamid));
return bcadd(bcadd('76561197960265728', $parts['1']), bcmul($parts['2'], '2'));
}
|
Just be aware that this will fail on 32-bit systems as PHP uses 32-bit integers for integer math on them. Unless PHP changed this in the later 5.x versions or in 7.0.
__________________