mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-02 08:42:15 +09:00
Improve validation and formatting for 0303 and 0505 phone numbers
This commit is contained in:
parent
1d22aa9a44
commit
d873196aa8
2 changed files with 18 additions and 1 deletions
|
|
@ -47,7 +47,14 @@ class Korea
|
|||
default:
|
||||
if (substr($num, 0, 4) === '0303' || substr($num, 0, 3) === '050')
|
||||
{
|
||||
return substr($num, 0, 4) . '-' . substr($num, 4, 3) . '-' . substr($num, 7);
|
||||
if (strlen($num) === 12)
|
||||
{
|
||||
return substr($num, 0, 4) . '-' . substr($num, 4, 4) . '-' . substr($num, 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
return substr($num, 0, 4) . '-' . substr($num, 4, 3) . '-' . substr($num, 7);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -77,6 +84,10 @@ class Korea
|
|||
{
|
||||
return true;
|
||||
}
|
||||
if (preg_match('/^0(?:303|505)[2-9][0-9]{6,7}$/', $num))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue