/home/techb158/ileadtechnology.com/vendor/fzaninotto/faker/src/Faker/Provider/ms_MY
Edit: /home/techb158/ileadtechnology.com/vendor/fzaninotto/faker/src/Faker/Provider/ms_MY/Person.php (63036B)
generator->parse(static::randomElement($formats));
}
/**
* Return a Malaysian I.C. No.
*
* @example '890123-45-6789'
*
* @link https://en.wikipedia.org/wiki/Malaysian_identity_card#Structure_of_the_National_Registration_Identity_Card_Number_(NRIC)
*
* @param string|null $gender 'male', 'female' or null for any
* @param bool|string|null $hyphen true, false, or any separator characters
*
* @return string
*/
public static function myKadNumber($gender = null, $hyphen = false)
{
// year of birth
$yy = mt_rand(0, 99);
// month of birth
$mm = DateTime::month();
// day of birth
$dd = DateTime::dayOfMonth();
// place of birth (1-59 except 17-20)
while (in_array($pb = mt_rand(1, 59), array(17, 18, 19, 20))) {
}
// random number
$nnn = mt_rand(0, 999);
// gender digit. Odd = MALE, Even = FEMALE
$g = mt_rand(0, 9);
//Credit: https://gist.github.com/mauris/3629548
if ($gender === static::GENDER_MALE) {
$g = $g | 1;
} elseif ($gender === static::GENDER_FEMALE) {
$g = $g & ~1;
}
// formatting with hyphen
if ($hyphen === true) {
$hyphen = "-";
} elseif ($hyphen === false) {
$hyphen = "";
}
return sprintf("%02d%02d%02d%s%02d%s%03d%01d", $yy, $mm, $dd, $hyphen, $pb, $hyphen, $nnn, $g);
}
}