$phone = "(021)423-2323"; if (preg_match('/\(?\d{3}\)?[-\s.]?\d{3}[-\s.]\d{4}/x', $phone)) { echo "Your phone number is ok."; } else { echo "Wrong phone number."; }