View Single Post
Leonardo
Veteran Member
Join Date: Feb 2010
Location: 90's
Old 10-09-2014 , 08:29   Re: Convert STEAMID to Steam Community ID
Reply With Quote #337

I'll just leave it here.
PHP Code:
function ReadSteamID64$SteamID64 )
{
    if( !
is_numeric$SteamID64 ) ) return null;
    
$binary str_padbcdecbin$SteamID64 ), 64'0'STR_PAD_LEFT );
    return array(
        
'account'    => bindecsubstr$binary, -32 ) ),
        
'instance'    => bindecsubstr$binary, -5220 ) ),
        
'type'        => bindecsubstr$binary, -56) ),
        
'universe'    => bindecsubstr$binary, -64) )
    );
}

function 
BCDecBin$i )
{
    
bcscale);
    
$o '';
    do
    {
        
$o bcmod$i) . $o;
        
$i bcdiv$i);
    }
    while( 
bccomp$i) );
    return 
$o;

__________________

Last edited by Leonardo; 10-26-2014 at 08:25.
Leonardo is offline