Skip to content

Instantly share code, notes, and snippets.

@Michaelkodji
Forked from manutheblacker/code.php
Created May 27, 2020 11:45
Show Gist options
  • Save Michaelkodji/e14a00a312c760e9397da5f7871f4c78 to your computer and use it in GitHub Desktop.
Save Michaelkodji/e14a00a312c760e9397da5f7871f4c78 to your computer and use it in GitHub Desktop.
code de generation de code
<?php
function passgen2($nbChar){
return substr(str_shuffle('abcdefghijklmnopqrstuvwxyzABCEFGHIJKLMNOPQRSTUVWXYZ0123456789'),1, $nbChar);
}
function generate_code_ticket($ticket_number=1){
$ticket_disponible = array();
while($ticket_number > 0){
$ticket_code = passgen2(9);
array_push($ticket_disponible, array($ticket_number => $ticket_code));
$ticket_number -=1;
}
return $ticket_disponible;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment