芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/xmintal-back/vendor/fakerphp/faker/src/Faker/Provider/ms_MY/Person.php
generator->parse(static::randomElement($formats)); } /** * Return a Malaysian I.C. No. * * @example '890123-45-6789' * * @see 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 = self::numberBetween(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 = self::numberBetween(1, 59), [17, 18, 19, 20], false)) { } // random number $nnn = self::numberBetween(0, 999); // gender digit. Odd = MALE, Even = FEMALE $g = self::numberBetween(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); } }