Skip to content

Instantly share code, notes, and snippets.

@dstorozhuk
Created June 27, 2017 05:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dstorozhuk/5e33cbb5abacc07be1cd5cf48a73cfed to your computer and use it in GitHub Desktop.
Save dstorozhuk/5e33cbb5abacc07be1cd5cf48a73cfed to your computer and use it in GitHub Desktop.
Расшифровка идентификационного номера (Украина) в PHP получение даты рождения и пола
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