[Last Call] Learn how to a build a cloud-first strategyRegister Now

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

Need to Generate Random number

I need to generate a random number of 12 characters long I.E. and put it into a variable

001294818387
102948582891
390012948214
0
thaburner
Asked:
thaburner
3 Solutions
 
glcumminsCommented:
See http://www.php.net/rand :

$var = rand(100000000000, 999999999999);
0
 
nplibCommented:
echo mt_rand(0, 999999999999);
0
 
nplibCommented:
$var = mt_rand(0, 999999999999);
0
 
rivusglobalCommented:
http://ca3.php.net/manual/en/function.mt-rand.php

echo mt_rand(0, 999999999999);

With returns of less than 12 digits long, you can create a function to add the zeros in front of the generated value.
0
 
thaburnerAuthor Commented:
worked perfects thanks....
0

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.

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