Skip to content

Instantly share code, notes, and snippets.

@mcunha98
Created June 15, 2022 13:05
Show Gist options
  • Select an option

  • Save mcunha98/8c5cc9f48a595978627d6ce99e74fd08 to your computer and use it in GitHub Desktop.

Select an option

Save mcunha98/8c5cc9f48a595978627d6ce99e74fd08 to your computer and use it in GitHub Desktop.

Revisions

  1. mcunha98 created this gist Jun 15, 2022.
    17 changes: 17 additions & 0 deletions PHP Generate GUID.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    <!DOCTYPE html>
    <html>
    <body>
    <?php
    for ($i = 1; $i <= 10; $i++)
    {
    echo guid() . "<br>";
    }

    function guid()
    {
    $base = md5(uniqid() . time() . rand(1000,9999));
    return substr($base,0,8) . "-" . substr($base,8,4) . "-" . substr($base,12,4) . "-" . substr($base,16,4) . "-" . substr($base,20,12);
    }
    ?>
    </body>
    </html>