Created
April 30, 2016 23:48
-
-
Save nicopenaredondo/c13e032b6598ffae0fda38ee825ba439 to your computer and use it in GitHub Desktop.
UNIQUE REFNO
This file contains 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 | |
function codeGenerator($length) | |
{ | |
$az = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZMULTIPAY'; | |
$azr = rand(0, 51); | |
$azs = substr($az, $azr, 10); | |
$stamp = hash('sha256', time()); | |
$mt = hash('sha256', mt_rand(5, 20)); | |
$alpha = hash('sha256', $azs); | |
$hash = str_shuffle($stamp . $mt . $alpha); | |
$code = strtoupper(substr($hash, $azr, $length)); | |
return $code; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment