We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
function msisdn($phoneNumber, $countryCode = '256', $networkCodes = '39|76|77|78') { $phoneNumber = preg_replace('/[^\d]/', '', $phoneNumber); if(! preg_match("/^(0|{$countryCode})({$networkCodes})[\d+]{7}$/", $phoneNumber, $matches)) { throw new \InvalidArgumentException('Invalid phone number'); } if($matches[1] == '0') { $phoneNumber = substr_replace($phoneNumber, $countryCode, 0, 1); } return $phoneNumber; } echo msisdn('0788123456'); // 256788123456 - OK echo msisdn('0700123456'); // Invalid phone number echo msisdn('256788123456'); // 256788123456 - OK echo msisdn('+256788123456'); // 256788123456 - OK echo msisdn('+256 (788) 123456'); // 256788123456 - OK echo msisdn('+46 (788) 123456'); // Invalid phone number
The text was updated successfully, but these errors were encountered:
what is the issue here ?
Sorry, something went wrong.
No apparent issue.
I just documented it as a desirable improvement for the next version borrowing from another momo plugin I worked on recently.
No branches or pull requests
The text was updated successfully, but these errors were encountered: