Created
July 9, 2015 13:10
-
-
Save weaverryan/0046c2a861d33795f367 to your computer and use it in GitHub Desktop.
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 | |
| /** | |
| * Generates a random alphanumeric string | |
| * | |
| * @return string | |
| */ | |
| private static function generateOrderId() | |
| { | |
| // most characters, except those that look like others (e.g. o and 0) | |
| $characters = 'ABCDEFGHJKMNPQRSTUVWXYZ23456789'; | |
| $string = ''; | |
| for ($i = 0; $i < 10; $i++) { | |
| $string .= $characters[rand(0, strlen($characters) - 1)]; | |
| } | |
| return $string; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment