How to Generate 4 Digit Unique Random Numbers in PHP?

Generate a 4 Digit Unique Number using PHP, Generate a 4 Digits Random Number using PHP, Get 4 Digits Random Number in PHP, Create 4 Digits Random Number Using PHP, 4 Digit Unique Number Generate in PHP

Hello Friends Today I will tell you through this Tutorial how you can generate the random number of Four digits in PHP.

mt_rand(1000,9999); This is the inbuild function of a php, you can generate a random number of 4 digit through it.

So let us know how this function is used.

You create a file called a fourdigitrandom.php and then copy and paste this php code into fourdigitrandom.php file. Then after that you open it on the local server.


$fourdigitrandom = rand(1000,9999); 
echo $fourdigitrandom;