?
Solved

PHP: script to generate 10 random numbers?

Posted on 2010-11-29
5
Medium Priority
?
455 Views
Last Modified: 2012-05-10
Hello experts,

I need to write a php script that randomly generates 10 digit numbers.

Any ideas?

thanks.
0
Comment
Question by:epifanio67
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 27

Accepted Solution

by:
Cornelia Yoder earned 2000 total points
ID: 34235100
$number=rand()%1000000000;
0
 
LVL 27

Expert Comment

by:Cornelia Yoder
ID: 34235117
The % is the "remainder" operator.  You can adjust the number of digits you get by adjusting the 1000000000 number.
0
 

Author Comment

by:epifanio67
ID: 34235258
thank you expert,

$number=rand()%1000000000;
it generates a random 5 digit number; but every time one refreshes the browser..

what I meant is: I need to create an array of random numbers
using rand(8,20)

see what I mean?

thanks,
regards
0
 

Author Closing Comment

by:epifanio67
ID: 34235318
I got it... thank you
0
 
LVL 27

Expert Comment

by:Cornelia Yoder
ID: 34235609
Glad you got what you needed ... it wasn't exactly clear from

   "...script to generate 10 random numbers" and
   "...script that randomly generates 10 digit numbers"

which it was that you actually needed, but creating an array of 10 numbers is pretty easy, so I figured you needed the other.


0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question