Generating a random numbers and letters

前端 未结 15 1179
梦如初夏
梦如初夏 2020-12-25 08:23

Can I ask for a certain code on how to generate a random letters and numbers in one word. I know there\'s a PHP function rand(), but I don\'t know if it\'s also applicable w

15条回答
  •  梦毁少年i
    2020-12-25 08:35

    Use uniqid

    $desired_length = 10; //or whatever length you want
    $unique = uniqid();
    
    $your_random_word = substr($unique, 0, $desired_length);
    

提交回复
热议问题