TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Mohammed Adamu
NA
107
48k
How to generate unique random numbers using php
Feb 20 2017 9:34 PM
Please i need help on how to generate highly unique id for my php program, i have one which is doing that but after about 190 unique numbers it started to repeat itself which is making the unique column in the database problematic. please here is my code code if there is something i did wrong please help me correct it thanks. "
function uniqids() {
$chars = "003232303232023232023456789";
srand((double)microtime()*1000000);
$i = 0;
$pass = '' ;
while ($i <= 7) {
$num = rand() % 33;
$tmp = substr($chars, $num, 1);
$pass = $pass . $tmp;
$i++;
}
return $pass;
}
$finalcode='RS-'.uniqids();
"
Reply
Answers (
8
)
How to POST value to PHP in the same page using jQuery
how to send mail in php