Generate unique random alphanumeric characters that are 7 characters long

前端 未结 15 774
予麋鹿
予麋鹿 2020-12-09 00:32

It need not be meaningful words - more like random password generation, but the catch is - they should be unique. I will be using this for some kind of package / product cod

15条回答
  •  北荒
    北荒 (楼主)
    2020-12-09 01:04

    Use Kohana text,

    http://docs.kohanaphp.com/helpers/text

    For example,

       $prod_id = text::random('alpha', 7);
    

    If you don't want use the framework, you can simply copy the code. You will find lots of goodies there.

提交回复
热议问题