random four digit in php code example
Example 1: php randon integer 4 digit
$digits = 3;
echo rand(pow(10, $digits-1), pow(10, $digits)-1);
Example 2: php random 5 digit number
$limit = 3;
echo random_int(10 ** ($limit - 1), (10 ** $limit) - 1);