Skip to content

Instantly share code, notes, and snippets.

@nicopenaredondo
Created April 30, 2016 23:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicopenaredondo/c13e032b6598ffae0fda38ee825ba439 to your computer and use it in GitHub Desktop.
Save nicopenaredondo/c13e032b6598ffae0fda38ee825ba439 to your computer and use it in GitHub Desktop.
UNIQUE REFNO
<?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