<?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);
- Output for git.master, git.master_jit, rfc.property-hooks
- 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
This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.
Active branches
Archived branches
Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page
preferences:
42.82 ms | 401 KiB | 8 Q