Skip to content
Browse files

Validate_IR, added detailed comment on ssn.

git-svn-id: http://svn.php.net/repository/pear/packages/Validate/trunk@309410 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
1 parent 95dc7e9 commit 1a59ac14e5e0fafa11520de0c5faf2ae42eb889f @hemmat hemmat committed Mar 18, 2011
Showing with 8 additions and 1 deletion.
  1. +8 −1 Validate/IR.php
View
9 Validate/IR.php
@@ -107,7 +107,14 @@ function postalCode($check)
}
/**
- * Checks social security numbers for Iran called "kode melli"
+ * Checks social security numbers for Iran called "kode melli".
+ * kode melli's last digit from left is the check digit, here is the algorithm:
+ * A= last digit from left
+ * B= (first digit*10) + (2th digit*9) + ... (9th digit *2)
+ * C= B – (B/11)*11
+ * if C==0 and A==0 OK
+ * if C==1 and A==1 OK
+ * if C>1 and A==(C-11) OK
*
* @param string $check The value to check.
*

0 comments on commit 1a59ac1

Please sign in to comment.
Something went wrong with that request. Please try again.