Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 459
  • Last Modified:

PHP: script to generate 10 random numbers?

Hello experts,

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

Any ideas?

thanks.
0
epifanio67
Asked:
epifanio67
  • 3
  • 2
1 Solution
 
Cornelia YoderArtistCommented:
$number=rand()%1000000000;
0
 
Cornelia YoderArtistCommented:
The % is the "remainder" operator.  You can adjust the number of digits you get by adjusting the 1000000000 number.
0
 
epifanio67Author Commented:
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
 
epifanio67Author Commented:
I got it... thank you
0
 
Cornelia YoderArtistCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now