• Published:September 18th, 2013
  • Category:php
  • 2 comments

I couldn’t find a decent PHP function to check the validation of the so called “rijksregisternummer” in Belgium (or “numéro de registre national” in French). I did however find a well written C# function by Tjeuten, so I decided to translate his C# function into PHP.

This is the result (html form checker incl):

Rijksregisternummer:
Gender:
unknown
female
male

997){
$counterOK = false;
} else if ($counterPart % 2 == 0) { //EVEN
$counterOK = true;
$gender = "F"; //FEMALE
} else {
$counterOK = true;
$gender = "M"; //MALE
}

if($givenGender != ""){
if($givenGender == $gender){
$genderOk = true;
}
} else {
$genderOk = true;
}

/* 4. RETURN GENDER OR MESSAGE */
/*******************************/

$message = "";

if (!$birthDateOK){
$message .= "Invalid birthdate;";
}
if (!$counterOK){
$message .= "Invalid counter;";
}
if (!$controlOK){
$message .= "Invalid control number;";
}
if (!$genderOk){
$message .= "Invalid gender;";
}

if ($message != "") //THERE ARE ERRORS
{
return $message;
} else {
return true;
}
}
}
}
else
{
return "isnull";
}
}


Rss Comments

2 comments

  1. Hi! Great blog template. What is its name?

    #1 Brady
  2. A tweaked version of Minibits.

    #2 Robin

Leave a comment






Wordpress.org clearPaper by CreativeBits.it Copyright © 2012-2019 Robin Brackez. All rights reserved. By visiting this site you agree to accept cookies that are purely used to check how many visitors I have. Theme by: creativebits. Custom adaptations by Robin Brackez.