- bin2hex: documentation ( source)
- str_replace: documentation ( source)
- rand: documentation ( source)
- srand: documentation ( source)
<?php
$success = "";
$size = 32;
$token = "";
$seed = (int)bin2hex(openssl_random_pseudo_bytes($size / 2));
srand($seed);
for($i = 0; $i < 16; $i++) {
$randomDigit = (string)rand() % 10;
$token .= "," . $randomDigit;
}
$token = str_replace(",", "", $token);
echo $token;
?>