Skip to content

Instantly share code, notes, and snippets.

@karson
Created March 6, 2022 07:16
Show Gist options
  • Save karson/be26e3ff004c01cf2410ffbabc92d513 to your computer and use it in GitHub Desktop.
Save karson/be26e3ff004c01cf2410ffbabc92d513 to your computer and use it in GitHub Desktop.

Revisions

  1. karson created this gist Mar 6, 2022.
    11 changes: 11 additions & 0 deletions randomstring.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    <?php
    //method1
    $get_random_string = md5(microtime());

    //method2
    public static function get_quickRandom($length = 16)
    {
    $data_pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';

    return substr(str_shuffle(str_repeat($data_pool, $length)), 0, $length);
    }