Generate random numbers or OTP with function in PHP
function generateNumericOTP($n=6) {
$generator = "1357902468";
$result = "";
for ($i = 1; $i <= $n; $i++) {
$result .= substr($generator, (rand()%(strlen($generator))), 1);
}
return $result;
}
generateNumericOTP(4);
Comments
Post a Comment