• 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

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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