Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save rastating/1ae5eeeaa35e5e04344c to your computer and use it in GitHub Desktop.

Select an option

Save rastating/1ae5eeeaa35e5e04344c to your computer and use it in GitHub Desktop.

Revisions

  1. @almirsarajcic almirsarajcic renamed this gist Sep 20, 2013. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. @almirsarajcic almirsarajcic revised this gist Jan 29, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions test.php
    Original file line number Diff line number Diff line change
    @@ -4,11 +4,11 @@ function convert_id($id)
    {
    if (strlen($id) === 17)
    {
    $converted = substr($id, 7) - 7960265728;
    $converted = substr($id, 3) - 61197960265728;
    }
    else
    {
    $converted = '7656119'.($id + 7960265728);
    $converted = '765'.($id + 61197960265728);
    }

    return (string) $converted;
  3. @almirsarajcic almirsarajcic revised this gist Jan 29, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions test.php
    Original file line number Diff line number Diff line change
    @@ -4,11 +4,11 @@ function convert_id($id)
    {
    if (strlen($id) === 17)
    {
    $converted = substr($id, 8) - 960265728;
    $converted = substr($id, 7) - 7960265728;
    }
    else
    {
    $converted = '76561197'.($id + 960265728);
    $converted = '7656119'.($id + 7960265728);
    }

    return (string) $converted;
  4. @almirsarajcic almirsarajcic revised this gist Jan 29, 2013. 2 changed files with 21 additions and 13 deletions.
    13 changes: 0 additions & 13 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,13 +0,0 @@
    public function convert_id($id)
    {
    if (strlen($id) === 17)
    {
    $converted = substr($id, 8) - 960265728;
    }
    else
    {
    $converted = '76561197'.($id + 960265728);
    }

    return (string) $converted;
    }
    21 changes: 21 additions & 0 deletions test.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    <?php

    function convert_id($id)
    {
    if (strlen($id) === 17)
    {
    $converted = substr($id, 8) - 960265728;
    }
    else
    {
    $converted = '76561197'.($id + 960265728);
    }

    return (string) $converted;
    }

    $sixtyfour = '76561197992765754';
    $thirtytwo = '32500026';

    var_dump(convert_id($thirtytwo) === $sixtyfour); // bool(true)
    var_dump(convert_id($sixtyfour) === $thirtytwo); // bool(true)
  5. @almirsarajcic almirsarajcic created this gist Jan 29, 2013.
    13 changes: 13 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    public function convert_id($id)
    {
    if (strlen($id) === 17)
    {
    $converted = substr($id, 8) - 960265728;
    }
    else
    {
    $converted = '76561197'.($id + 960265728);
    }

    return (string) $converted;
    }