Virajsinh

OTP Generate in PhP

Aug 24th, 2020
973
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $otp = substr(str_shuffle("0123456789"), 0, 4);
  2.  
  3. $otp = str_pad(rand(0000,9999), 4, "0", STR_PAD_LEFT); // 4 Digit, add "0" if Length is 5 and generate digit is 4
  4.  
  5. $randomString = substr(str_shuffle("0123456789abcdefghijklmnopqrstvwxyzABCDEFGHIJKLMNOPQRSTVWXYZ"), 0, 11) // string Length 11
RAW Paste Data