Jump to content

Help with SSN validation


PHPandME1

Recommended Posts

I am very much a php beginner and I am trying to figure out how to write some to code to validate a social security number. The question I am working on is:

 

"Write a PHP function called isValidSSN that validates a social security number. The function takes 2 parameters. The first parameter is a string that represents the ssn. The second parameter is a reference parameter that will store the error message generated by the function when the ssn is incorrect. The error message should indicate if a ssn was not provided or if the ssn that was provided is in the wrong format. A valid ssn must be in the format ###-##-#### where # is a digit and the dashes MUST be included. The function should return true if the ssn is valid and false if the ssn is invalid."

 

I am completely lost so any assistance would be much appreciated. Thank you!

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.