Answer the question
In order to leave comments, you need to log in
Why is my generator not working?
Hello. I made a generator of random letters and numbers by mask.
There is a variable , which, respectively, is the same mask.
The generator itself:$promo_mask = 'XXXX-5555-XXXX-5555';
$mask_count = substr_count($promo_mask, 'X');
$chars = '12345ABCDEFGHIJKLMNOPQRSTUVWXYZ67890';
$hashpromo = '';
for($ichars = 1; $ichars <= $mask_count; ++$ichars) {
$random = str_shuffle($chars);
$promo = str_replace('X', $random[$ichars], $promo_mask);
}
echo $promo;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question