Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- - Pin Generator
- - Generates an x-digit pin number. The pin number never starts with 0.
- - Can be converted to an integer with php's intval() function.
- $length - The amount of digits the pin number should have.
- */
- public function generatePin($length = 4) {
- $pin = '';
- for ($i = 0; $i < $length; $i++) {
- if ($i == 0)
- $pin .= rand(1, 9);
- else
- $pin .= rand(0, 9);
- }
- return $pin;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement