public function MobileNumberUtil::generateVerificationCode in Mobile Number 2.0.x
Same name and namespace in other branches
- 8 src/MobileNumberUtil.php \Drupal\mobile_number\MobileNumberUtil::generateVerificationCode()
Generates a random numeric string.
Parameters
int $length: Number of digits.
Return value
string Code in length of $length.
Overrides MobileNumberUtilInterface::generateVerificationCode
File
- src/
MobileNumberUtil.php, line 225
Class
- MobileNumberUtil
- Turns a render array into a HTML string.
Namespace
Drupal\mobile_numberCode
public function generateVerificationCode($length = 4) {
return str_pad((string) rand(0, pow(10, $length)), $length, '0', STR_PAD_LEFT);
}