Try validating the generated SINs against the government guidelines, and it fails every time there's an invalid prefix digit. I'm seeing 8's and 0's coming back from the function as it is and I'm digging in to figure out why.
UPDATE
OK maybe it's my php implementation, but the array_rand line is returning stuff not in the $validPrefix array. I was seeing zeros as the first character, which broke validation.
Try validating the generated SINs against the government guidelines, and it fails every time there's an invalid prefix digit. I'm seeing 8's and 0's coming back from the function as it is and I'm digging in to figure out why.
UPDATE
OK maybe it's my php implementation, but the array_rand line is returning stuff not in the $validPrefix array. I was seeing zeros as the first character, which broke validation.
my code now looks like this, and works every time.