Today, through the experts trick tutorial website, we will understand how to generate a 16 digit number at random. So let’s go.
php has only inbuilt function (mt_rand) of php to generate random number. In which you can generate any number from 0 to 9. This function supports all version of php.
For example you are given below.
mt_rand(0, 9)
How to Generate 16 Digits Random Number?
Now I will tell you how you can generate a random number of 16 digits using this function. Whose example is given below
generate_16_digit_random_number.php
<?php function generatenumber($limit){ $code = ''; for($i = 0; $i < $limit; $i++) { $code .= mt_rand(0, 9); } return $code; } echo generatenumber(16); ?>