Introduction: NRIC Validation (PHP)

This code will display all the valid NRIC in Singapore.

There are few website that shown how the algorithm works.

Now first what you need is :

  • Apache (I use xamp)
  • Notepad
  • Basic programming knowledge

Step 1: Create Page

First, create a file in the HTDOC name it as whatever you want, i recommend you name it as index.php

source code :

http://pastebin.com/R8dm5UvR

Step 2: Create Class

Now, you need to create a file name NRIC.php and add this code in :

http://pastebin.com/LcMU1RTm

Step 3: Changing the NRIC

To change the NRIC, go to index.php, find this -> $firman->isNRICValid("S000".$a.$b.$c.$d."I"); you can change the first 4 digit and the last letter.

Step 4: Credit

Credit to the person who upload this on the internet and i just did a little modification on the codes.

http://stackoverflow.com/questions/629664/how-to-validate-a-singaporean-fin

To list out all the valid NRIC, type in index.php?valid (example).