Created
March 6, 2022 07:16
-
-
Save karson/be26e3ff004c01cf2410ffbabc92d513 to your computer and use it in GitHub Desktop.
Generate Secure random string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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