fork(373) download
  1. <?php
  2. // NS2 SteamID Formatter by Whosat
  3. // Enter each new or old-style SteamID into stdin
  4. // The converter will automatically detect the type
  5. // Enter them one per line
  6. $hi = fopen('php://stdin', "r");
  7. $ho = fopen('php://stdout', "w");
  8.  
  9. while (fscanf($hi, "%s", $steamid)) {
  10. $parts = explode(':', $steamid);
  11. if(count($parts) == 1) {
  12. // New -> Old
  13. if($parts[0] % 2 > 0)
  14. fwrite($ho, 'STEAM_0:1:'.(($parts[0]-1)/2)."\n");
  15. else
  16. fwrite($ho, 'STEAM_0:0:'.($parts[0]/2)."\n");
  17. } else // Old -> New
  18. fwrite($ho, $parts[2]*2+$parts[1]."\n");
  19. }
  20.  
  21. fclose($ho);
  22. fclose($hi);
  23. ?>
Success #stdin #stdout 0.02s 13064KB
stdin
STEAM_0:0:919317
STEAM_0:1:919317
stdout
1838634
1838635