OTP messages

hii Goodhii Good Afternoon :slight_smile: FRIENDS
Can one tell how to generate OTP in php ?

Isn’t that specific to Erlang?

Are you looking for algorithm to generate some random characters sequence or what?

random character

Something like that will give you 32 “random” characters (only letters and digits):

$randomString = md5(rand(1, 65535) . microtime());

You can shorten it to, say 8 characters, by stripping a random part of the original sequence:

$desiredLength = 8;
$shortString = substr($randomString, rand(0, 31-$desiredLength), $desiredLength);

I’ve given like this…

function rand_string( $length ) {

$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#*%!";
return substr(str_shuffle($chars),0,$length);

}
$random= rand_string(8);

…so what is the problem?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.