Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanSSn #4

Open
nenads opened this issue Jan 1, 2019 · 1 comment
Open

cleanSSn #4

nenads opened this issue Jan 1, 2019 · 1 comment

Comments

@nenads
Copy link

nenads commented Jan 1, 2019

When year is 2019 this is failing adding 20 in front

private function cleanSsn($ssn)
{

    $ssn = preg_replace("/[^0-9]/", "", $ssn);

    $split = substr($ssn, 0, 2);

    if ($split != 19 && $split > date('y')) {
        $ssn = '19' . $ssn;
    }
    if ($split != 20 && $split <= date('y')) {
        $ssn = '20' . $ssn;
    }

    return $ssn;
@Ken1S
Copy link

Ken1S commented Feb 28, 2019

Could be useful to add check if century numbers are already in place

function cleanSsn($ssn)
{
$ssn = preg_replace("/[^0-9]/", "", $ssn);

if(12 === strlen($ssn))
	return $ssn;	

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants