I am explaining you, how to generate random numbers in PHP. I will use rand() function to generate random numbers. rand() function can able to use to generate a random number with specific range like starting number is 1 and ending number id 999 so it will generate random number in between. you can use any number as per requirement.
if you will not provide range so it will generate large number.
Syntax :
rand();
rand(min,max);
//min minimum integer number
//max maximum integer number
Example :
<?php
echo rand(1, 50) . "<br>";
echo rand(51, 250) . "<br>";
echo rand();
?>
Output :
49
166
591487216
Hello, Welcome to webdeveloperindia.in. I am a full-stack web developer. Email – [email protected] | Skype – azaruddin23. I have knowledge of PHP, Laravel, Magento 1/2, Codeigniter, WordPress, Joomla, Shopify, Git, Bitbuket, jQuery, Ajax, Javascript and ReactJS.