Wednesday 20 April 2022

How to generate random number?

Using following code we can create random number. Than can be use Order number, unique id or like something that.

<?php 

//Unique or Random number Generate
//$today = date("Ymd");
$today = date("dmY");
$random = strtoupper(substr(uniqid(sha1(time())),0,6));
echo $order_no = $today . $random;

?>


For more Interesting, Useful Article & codes visit IT New Code.

Ankit Shah PHP Expert

IT New Code suggest a solution for your problem related to coding, Specially .PHP, Wordpress, WooCommerce, Magento, HTML and CSS. Visit Our website for Information.

0 comments:

Post a Comment

 

Copyright @ 2016 IT New Code | Developing Code | Designing Code.

Designed by: Ankit Shah