I want to generate 6 digit unique code but i want first 3 are alphabets and last 3 are numbers like below example..
AAA111
ABD156
DFG589
ERF542...
Please help to create code with above combinations..
below is my code..
public function generateRandomString() {
$characters = '1234567890';
$length = 6;
$charactersLength = strlen($characters);
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, $charactersLength - 1)];
}
return $randomString;
}
Aucun commentaire:
Enregistrer un commentaire