Generate an N-digit random number

后端 未结 7 1587
清酒与你
清酒与你 2020-12-05 09:49

I want to generate a 6 digit random number using the PHP mt_rand() function.

I know the PHP mt_rand() function only takes 2 parameters: a <

7条回答
  •  萌比男神i
    2020-12-05 10:37

    If the first member nunmber can be zero, then you need format it to fill it with zeroes, if necessary.

    
    

    Or, if it can be form zero, you can do that, to:

    
    

提交回复
热议问题