Skip to main content

Unable to restrict unique random generation to required output

I want to restrict the unique numbers to be only 8 characters long with my prefix. Here is what i do

$prefix             =  "CEVO";
$u_unique_id        =  str_shuffle(md5(uniqid(rand(100000,999999), true)));
$user_unique_id     =  $prefix.$u_unique_id;

But this code isn't restricting to 8 characters. Where i am wrong?



source https://stackoverflow.com/questions/70635786/unable-to-restrict-unique-random-generation-to-required-output

Comments