Order Number problem solving? $ OrderYmdHis). mt_rand (); is this correct? Why is the gb_0000505 obtained in this way? How likely will this order number be to be the same? ------ Solution -------------------- random number, of course, the probability is the same, but there may be repeated ---- Order number problem solving?
$ Orderid = GB _. substr (date ('ymdhis '). mt_rand );
Is that true?
Why is the gb_0000505 obtained in this way? How likely will this order number be to be the same?
------ Solution --------------------
Of course, the probability of a random number is the same, but there is a possibility of repetition.
------ Solution --------------------
GB _. substr (date ('ymdhis '). mt_rand );
Substr ($ string, $ start, $ length );
This method requires three parameters: the first is the string, that is, your time, the second is the starting position of the truncation, and the third is the truncation length.
------ Solution --------------------
$ Orderid = 'GB _ '. date ('ymdhis'). mt_rand );
Although it is unlikely that a random number will conflict with each other (one thousandth of you)
But he is not continuous and is not easy to manage. It cannot prevent forgery.