Hi, I am looking for some example code that can help me to generate unique random string of numeric numbers in PHP Applications. I am hoping to resolve this issue with the help of tech developers working around & for this I have researched for many php questions & answers in various forums, but didn't get any satisfactory response. Hoping to get answer here.
|
PHP
How to generate unique key of random numbers in PHP |
|
Isn't mt_rand good enough or this haven't been suggested to you?
http://php.net/manual/en/function.mt-rand.php You see, Doctor, God didn't kill that little girl. Fate didn't butcher her and destiny didn't feed her to those dogs.
If God saw what any of us did that night he didn't seem to mind. From then on I knew... God doesn't make the world this way. We do.
Oct 17, 2016 11:07 AM
(This post was last modified: Oct 17, 2016 11:08 AM by Strider64.)
PHP Code is one way of doing it with OPENSSL. There are true php random number generators libraries out there on the net, just Google and you should find some scripts or how to do it.
Life is a fig newton of you imagination! ~ https://www.brainwaveblitz.com/canyousol..._solve.php
(Oct 17, 2016 11:07 AM)Strider64 Wrote: There are true php random number generators libraries out there on the net, just Google and you should find some scripts or how to do it. lol good luck with that
Oct 18, 2016 11:18 PM
(This post was last modified: Oct 18, 2016 11:21 PM by Zotima.)
PHP Code This usually generates random string of numbers . You can edit the length of numbers too @ $length. If you also want to add special chars and Alphabets just add each alphabet or char to the $charecters variable. For example: PHP Code
Oct 19, 2016 07:05 AM
(This post was last modified: Oct 19, 2016 07:06 AM by ASDA.)
(Oct 18, 2016 12:31 PM)Yani Wrote: You could use random_int() on PHP7 which is quite secure. It uses CryptGenRandom() on Windows and getrandom(2) on Linux, both of which are cryptographically safe. An official PHP5 userland implementation also exists. cryptographically secure != true random though |
|
|



