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.
Generate Secure random string
<?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);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment