23 February 2022

How to generate random numbers or OTP with function in PHP?

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);

No comments:

Post a Comment

How to run google search console request submission by UI vision IDE automate?

 Run google search console request submission by UI vision IDE automate? Source View --- Json Code {   "Name": "DemoCsvReadAr...