Created
June 27, 2017 05:12
-
-
Save dstorozhuk/5e33cbb5abacc07be1cd5cf48a73cfed to your computer and use it in GitHub Desktop.
Расшифровка идентификационного номера (Украина) в PHP получение даты рождения и пола
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function IdentificationNumber($number) | |
{ | |
$result = array(); | |
$result['number'] = $number; | |
$result['sex'] = (substr($number,8,1)%2) ? 'Мужчина' : 'Женщина'; | |
$split = str_split($number); | |
$execute = $split[0]*(-1)+$split[1]*5+$split[2]*7+$split[3]*9+$split[4]*4+$split[5]*6+$split[6]*10+$split[7]*5+$split[8]*7; | |
$number = substr($number,0,5); | |
$date = date('d.m.Y',strtotime('01.01.1900 + '.$number.' days - 1 days')); | |
list($result['day'],$result['month'],$result['year']) = explode('.',$date); | |
return $result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment