Created
May 27, 2020 11:44
-
-
Save manutheblacker/d73793d6d8d88f9b0375b7104b2f89ff to your computer and use it in GitHub Desktop.
code de generation de code
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 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