gerar número aleatório de 4 dígitos em php
<?php
$FourDigitRandomNumber = mt_rand(1111,9999);
echo $FourDigitRandomNumber;
?>
Ankur
<?php
$FourDigitRandomNumber = mt_rand(1111,9999);
echo $FourDigitRandomNumber;
?>
$limit = 3;
echo random_int(10 ** ($limit - 1), (10 ** $limit) - 1);
$digits = 3;
echo rand(pow(10, $digits-1), pow(10, $digits)-1);
<?php
$FourDigitRandomNumber = mt_rand(1111,9999);
echo $FourDigitRandomNumber;
?>