PHP Generate 4 Digit Unique Random Numbers Example
Hi Guys
In this blog, i will tell you how to generate 4 digit unique random numbers.we are random function using in php to generate 4 random numbers.you can easy to create 4 unique random digit in php.
we are show generate 4 digit unique random numbers example.you can create the random number of Four digits in PHP.
i will show two different function to generate 4 random numbers.first generate 4 unique random numbers for function mt_rand() and second generate 4 unique random numbers for function rand().
here the following example of generate 4 digit unique random numbers Example 1
here the example mt_rand() function using generate 4 digit unique random numbers
<?php
$fourRandomDigit = mt_rand(1000,9999);
echo $fourRandomDigit;
?>
Example 2 here the example rand() function using generate 4 digit unique random numbers
<?php
$fourRandomDigit = rand(1000,9999);
echo $fourRandomDigit;
?>
It will help you..
- How To Use Php Conditional Statement Example
- How to Check if String Contains Regex in PHP?
- PHP Array_column() Function Example
- PHP Generate List of Random Numbers Between 0 and 100 Example
- How to User Login with Facebook in PHP?
- How to Explode Every Character into Array Using PHP Example?
- PHP Form Validation Tutorial
- PHP Convert XML to JSON Example