전화번호 체크하기(휴대전화, 유선, 대표번호 등등)
if (!function_exists('phone_number_check')) {
function phone_number_check($pString)
{
$is_rule = false;
$re_phoneNum = preg_replace('/-/', '', $pString);
$mobile = preg_match('/^01[016789]{1}-?([0-9]{3,4})-?[0-9]{4}$/', $pString);
$tel = preg_match('/^(02|0[3-6]{1}[1-5]{1})-?([0-9]{3,4})-?[0-9]{4}$/', $pString);
$rep = preg_match('/^(15|16|18)[0-9]{2}-?[0-9]{4}$/', $pString);
$rep2 = preg_match('/^(02|0[3-6]{1}[1-5]{1})-?(15|16|18)[0-9]{2}-?[0-9]{4}$/', $pString);
$num = preg_match('/^(070|(050[2-8]{0,1})|080|013)-?([0-9]{3,4})-?[0-9]{4}$/', $pString);
if ($mobile != false) {
$is_rule = true;
if (strlen($re_phoneNum) > 11) {
$is_rule = false;
}
} else if ($tel != false) {
$is_rule = true;
if (strlen($re_phoneNum) > 11) {
$is_rule = false;
}
} else if ($rep != false) {
$is_rule = true;
if (strlen($re_phoneNum) != 8) {
$is_rule = false;
}
} else if ($num != false) {
$is_rule = true;
if (strlen($re_phoneNum) > 12) {
$is_rule = false;
}
} else {
$is_rule = false;
}
if ($rep2 == true) {
$is_rule = false;
}
return $is_rule;
}
}