Hi i have a function that generates random string, but i want to set 3 prefix's and system to choose random prefix of thoses specified? The prefix's is 001, 002 or 003. For example when i try to generate string i want my system to choose one prefix of these that i specify.
public function generateRandomNumber($length) {
$prefix = '001';
//$prefix = '001';
//$prefix = '001';
$characters = '0123456789';
$charactersLength = strlen($characters);
$randomNumber = '';
for ($i = 0; $i < $length; $i++) {
$randomNumber .= $characters[rand(0, $charactersLength - 1)];
}
return $prefix . $randomNumber;
}