Home > Backend Development > PHP Tutorial > PHP code to generate 16-digit random numbers_PHP tutorial

PHP code to generate 16-digit random numbers_PHP tutorial

WBOY
Release: 2016-07-13 10:18:43
Original
959 people have browsed it

PHP code to generate 16-digit random numbers

Sharing a PHP code to generate 16-digit random numbers, two methods for PHP to generate random numbers.

Method 1

The code is as follows:

 

 $a = mt_rand(10000000,99999999);

 $b = mt_rand(10000000,99999999);

echo $a.$b;

Method 2:

 

 $a = range(0,9);

for($i=0;$i<16;$i++){

 $b[] = array_rand($a);

 } // www.yuju100.com

var_dump(join("",$b));

 //Result string(16) "0179571910024734"

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/880146.htmlTechArticlephp code to generate 16-digit random numbers Share a code for php to generate 16-digit random numbers, php to generate random numbers Two methods. Method 1 code is as follows: ?php $a = mt_rand(10000000,99999999); $b...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template