How to generate random eight digit number in php?

To random generate the 8 digit code number
Simple copy and paste this code in you php file and run the file
You can also customize the code
<?php
                    $chars = "BC0DEFG1HJK3LMO4PQRS5TUW6XYZa7bcdefg8hijklimno9pqrst";
                        $res = "";
                        for ($i = 0; $i < 8; $i++) {  // you can replace 8 to any number to change the length of code
                        $res .= $chars[mt_rand(0, strlen($chars)-1)];
                        }
                        echo $coupon_code = $res;
  ?>

Comments