Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
Thread Tools Search this Thread Rate Thread
Old 17-Oct-2016, 04:03
Ashish Bisht Ashish Bisht is offline
New Member
Join Date: Jul 2016
Posts: 21
Ashish Bisht has a little shameless behaviour in the past

How to generate unique key of random numbers in PHP

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.
Old 26-Jan-2017, 16:03
virtfanxyr virtfanxyr is offline
New Member
Join Date: Jan 2017
Location: virtual fantasy
Posts: 5
virtfanxyr is on a distinguished road

Re: How to generate unique key of random numbers in PHP

example code:
PHP Code:

$num=mt_rand($min, $max);
echo "range{" . $min . "," . $max . "}<br/>random number is: " . $num; 

Old 30-Jan-2018, 17:47
neckozenica neckozenica is offline
New Member
Join Date: Nov 2017
Posts: 14
neckozenica is on a distinguished road

Re: How to generate unique key of random numbers in PHP


If you do not need it to be absolutely unique over time:

md5(uniqid(rand(), true))

Otherwise (given you have already determined a unique login for your user):

md5(uniqid($your_user_login, true))
vpswebserver. com VpsWebServer- Ultimate Windows VPS hosting | Dedicated hardware MS Hyper-V technology Premium bandwidth providers
vpswebserver. com/p/support/SupportTM[/url] - Chat support Full 24/7 help desk support Email support

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Zomex ~ #1 web hosting reseller templates - start your own hosting business zomex Reseller Hosting 0 11-Aug-2016 09:26
#1 responsive WHMCS templates since 09 | WHMCS - Wordpress - HTML5 - PHP | Welcome Fu zomex Member Announcements, Advertisements & Offers 0 08-Jun-2016 03:29
Help with generating random numbers C language. Nakz0r C Programming Language 1 21-Dec-2012 23:20
Help with random numbers da_bomb50 MySQL / PHP Forum 3 04-Aug-2004 19:34
Random numbers KrissKross C Programming Language 5 13-May-2004 19:31

Network Sites: GIDNetwork · GIDApp · GIDBlog · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 15:51.

vBulletin, Copyright © 2000 - 2018, Jelsoft Enterprises Ltd.