PESEL - Powszechny Elektroniczny System Ewidencji Ludności
Pesel Number has 11 digits.
First six digits are responsible for coding a date of birth.
First two digits are the two last digits for a year.
Third and fourth are responsible for coding a month and century.
The fifth and sixth digits are a day.
Tenth digit is responsible for sex. If it is odd you are a female, when odd you are a male.
The last digit is a check code.
First ten digits have weights:
weights:  1  3  7  9  1  3  7  9  1  3    
digits:  d1 d2 d3 d4 d5 d6 d7 d8 d9 d10 d11
Here is algorithm for finding d11:
sum = 1*d1+3*d2+7*d3+9*d4+1*d5+3*d6+7*d7+9*d8+1*d9+3*d10
C = sum mod 10
d11 = 10 - C
if C is 10 d11 = 0



Enter your PESEL:


PHP code:
for($i = 0; $i<11;  $i++)
{
if(!($pes[$i]>='0' && $pes[$i]<='9')) {
print "Incorrect PESEL!";
return 1;
}
$arr[$i] = $pes[$i]-'0';
}
$sum = $arr[0]*1+$arr[1]*3+$arr[2]*7+$arr[3]*9+$arr[4]*1+$arr[5]*3+$arr[6]*7+$arr[7]*9+$arr[8]*1+$arr[9]*3;
$sum %= 10;
if($sum==0) $sum=10;
if($sum!=(10-$arr[10])) {
print "Incorrect PESEL (code)!<BR>";
return 1;
}
$year = $arr[1]+$arr[0]*10;
$month = $arr[3]+$arr[2]*10;
if($month<13) {
$year+=1900;
}else if($month<33) {
$year+=2000;
$month-=20;
}else if($month<53) {
$year+=2100;
$month-=40;
}else if($month<73) {
$year+=2200;
$month-=60;
}else if($month<93) {
$year+=1800;
$month-=80;
}
if($arr[9]%2) {
print "You are a male";
}
else {
print "You are a female";
}
$day = $arr[5]+10*$arr[4];
print "You were born on $day $month $year";
print "Pesel: $pes;"


Back to main page