@ 2014-10-11T10:10:03Z <?php
function oldTextual($steamid) {
$result = 'Invalid input.';
if (!preg_match('([a-zA-Z])', $steamid) && strlen($steamid) === 17) { // 64-bit int
$acc_id = bcsub($steamid, '76561197960265728');
$result = 'STEAM_0:';
if ($acc_id % 2 === 0)
$result .= '0:';
else
$result .= '1:';
$result .= bcdiv($acc_id, '2', 0);
}
if (substr($steamid, 0, 2) === "U:") { // New textual format
$split = explode(':', $steamid);
$result = 'STEAM_0:';
$z = (int)$split[2];
if ($z % 2 === 0)
$result .= '0:';
else
$result .= '1:';
$acc_id = bcdiv($z, '2', 0);
$result .= $acc_id;
}
return $result;
}
function newTextual($steamid) {
$result = 'Invalid input.';
if (substr($steamid, 0, 6) === 'STEAM_') { // Old textual format
$split = explode(':', $steamid);
$y = $split[1];
$z = $split[2];
$acc_id = bcadd(bcmul($z, '2'), $y);
$result = 'U:1:' . $acc_id;
}
if (!preg_match('([a-zA-Z])', $steamid) && strlen($steamid) === 17) { // 64-bit int
$acc_id = bcsub($steamid, '76561197960265728');
$result = 'U:1:' . $acc_id;
}
return $result;
}
function numeric($steamid) {
$result = 'Invalid input.';
if (substr($steamid, 0, 6) === 'STEAM_') { // Old textual format
$split = explode(':', $steamid);
$commid = bcmul($split[2], '2');
if ($split[1] === '1')
$commid = bcadd($commid, '1');
$result = bcadd($commid, '76561197960265728');
}
if (substr($steamid, 0, 2) === "U:") { // New textual format
$filter = str_replace(['[', ']'], '', $steamid);
$split = explode(':', $filter);
$result = bcadd($split[2], '76561197960265728');
}
return $result;
}
$steamid64 = '76561198074715892';
$steamid32 = 'STEAM_0:0:57225082';
$steamid3 = 'U:1:114450164';
echo oldTextual($steamid64) . '<br>';
echo oldTextual($steamid3) . '<br>';
echo newTextual($steamid64) . '<br>';
echo newTextual($steamid32) . '<br>';
echo 'http://steamcommunity.com/profiles/' . numeric($steamid32) . '<br>';
echo 'http://steamcommunity.com/profiles/' . numeric($steamid3);
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 5.5.0 - 5.5.38 , 5.6.0 - 5.6.40 , 7.0.0 - 7.0.33 , 7.1.0 - 7.1.33 , 7.2.0 - 7.2.33 , 7.3.0 - 7.3.31 , 7.4.0 - 7.4.32 , 8.0.0 - 8.0.12 , 8.0.14 - 8.0.30 , 8.1.0 - 8.1.28 , 8.2.0 - 8.2.18 , 8.3.0 - 8.3.7 STEAM_0:0:57225082<br>STEAM_0:0:57225082<br>U:1:114450164<br>U:1:114450164<br>http://steamcommunity.com/profiles/76561198074715892<br>http://steamcommunity.com/profiles/76561198074715892 Output for 7.3.32 - 7.3.33 , 7.4.33 , 8.0.13 Fatal error: Uncaught Error: Call to undefined function bcsub() in /in/p9cEB:6
Stack trace:
#0 /in/p9cEB(81): oldTextual('765611980747158...')
#1 {main}
thrown in /in/p9cEB on line 6
Process exited with code 255 . Output for 5.4.0 - 5.4.45 Fatal error: Call to undefined function bcsub() in /in/p9cEB on line 6
Process exited with code 255 . Output for 4.4.2 - 4.4.9 , 5.1.0 - 5.1.6 , 5.2.0 - 5.2.17 , 5.3.0 - 5.3.29 Parse error: syntax error, unexpected '[', expecting ')' in /in/p9cEB on line 68
Process exited with code 255 . Output for 4.3.0 - 4.3.1 , 4.3.5 - 4.3.11 , 4.4.0 - 4.4.1 , 5.0.0 - 5.0.5 Parse error: parse error, unexpected '[', expecting ')' in /in/p9cEB on line 68
Process exited with code 255 . Output for 4.3.2 - 4.3.4 Parse error: parse error, expecting `')'' in /in/p9cEB on line 68
Process exited with code 255 . preferences:dark mode live preview
262.16 ms | 401 KiB | 460 Q