Pls,i need source code on pin code generator

hello! pls i need a source code on how to generate pincode that is connected to database. that is the code should ortenticate both used and unused pincode wen the user login.

$alphabet = array(‘A’,‘B’,‘C’,‘D’,‘E’,‘F’,‘G’,‘H’,‘I’,‘J’,‘K’,‘L’,‘M’,‘N’,‘O’,‘P’,‘Q’,‘R’,‘S’,‘T’,‘U’,‘V’,‘W’,‘X’,‘Y’,‘Z’);
$alphabet[rand(0, 25)];

or substr(rand(md5(“ABCDEFGHIJKLMNOPQRSTUVWXYZ”),25),0,1);

After getting the desired PIN number, you can validate it for if exists in the database and arrive at final pin number if does not exists.

Is there a reason you haven’t even attempted this?

This is a help forum, not a group of people to do your job for you.

If you’re looking for a 4 digit number, for example:

$pin = rand(0, 9999);