I am trying to generate support tickets for my website support option. I won't be using much features with the support system. I just want that the generated ticket ID numbers to not be repeated. What I tried gave me '0' two times in my database and single digits sometimes.
What I want is that whenever a new ticket is generated it should have consistent number of digits and never to repeat again.
The following is my code which I am using:
$token = openssl_random_pseudo_bytes(16);
$ticket = bin2hex($token);
Please guide me a better way.