How can I validate a Vehicle Identification Number with PHP? I just need to check if the entered VIN number is correct or not.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Here’s something I wrote up real quick using the example in the wikipedia article.
Not guaranteed perfect or bug free or super efficient, but should provide you with a solid starting point:
Note: I included the edits provided by Confluence below, making the procedure slightly more succinct.
Note: there is a small percent error with verifying VINs because of the nature of the checksum:
Also note:
11111111111111111will validate against the procedure above. Whether or not you want to check for that is up to you:reference: http://en.wikipedia.org/wiki/Vehicle_identification_number#Check_digit_calculation