Mostly in cases of User verification we use Random number as a Token Code of Verification that are combination of characters and numbers and send via Email Verification link or by SMS.
But it is more important that new generated token number will be generate all time unique for different different user.
in this Article i’m sharing Php Script that generate specified length Token number with a combination of Number and Characters using mt_rand function that Generate a better random value.
$length = 10;
$characters = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
$string = "";
for ($p = 0; $p < $length; $p++)
$string .= $characters[mt_rand(0, strlen($characters)-1)];