menghasilkan jumlah acak 4 digit dalam php
<?php
$FourDigitRandomNumber = mt_rand(1111,9999);
echo $FourDigitRandomNumber;
?>
Ankur
<?php
$FourDigitRandomNumber = mt_rand(1111,9999);
echo $FourDigitRandomNumber;
?>
<?php
$sixDigitRandomNumber = mt_rand(111111,999999);
echo $sixDigitRandomNumber;
?>
rand(0,10);
or
random_int(0,10)
$limit = 3;
echo random_int(10 ** ($limit - 1), (10 ** $limit) - 1);
$digits = 3;
echo rand(pow(10, $digits-1), pow(10, $digits)-1);
// $min and $max are optional
rand($min,$max);