I want to generate a random 9 character long integer.
I also want to make sure the first 3 digits aren't 814.
This is what I came up with so far:
Function to generate number:
public function randnum(){
$random = substr(number_format(time() * rand(),0,'',''),0,9);
return $random
}
Where I want to get the number at.
$random;
while ((substr(randnum(),0,3)) == '814'){
$random=substr(randnum(),0,3));
}
Is this the right way to ensure the number I get does not start with 814?