Created
August 25, 2016 10:17
-
-
Save petar-dambovaliev/0ad19c50706fe252c7128fe280843f5b to your computer and use it in GitHub Desktop.
Creates random codes
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
function unique_id($l = 8) { | |
return substr(md5(uniqid(mt_rand(), true)), 0, $l); | |
} | |
$codes = []; | |
$amount = 10000; | |
for ($i=0; count($codes) < $amount; $i++){ | |
$code = unique_id(); | |
$codes[$code] = $code; | |
} | |
$file = fopen("codes.csv","w"); | |
foreach ($codes as $code) | |
{ | |
fputcsv($file,explode(',',$code)); | |
} | |
fclose($file); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment