WC_Validation::is_phone │ public static │ WC 1.0

Validates a phone number using a regular expression.

Метод класса: WC_Validation{}

Хуки из метода

Возвращает

bool.

Использование

$result = WC_Validation::is_phone( $phone, $country );
$phone(строка) (обязательный)
Phone number to validate.
$country(строка|null)
The country code the phone is being validated for, or null if unknown.
По умолчанию: null

Код WC_Validation::is_phone() WC 11.3.0

public static function is_phone( $phone, $country = null ) {
	$valid = self::is_phone_format( $phone );

	/**
	 * Filters whether a phone number is considered valid.
	 *
	 * @since 11.0.0
	 *
	 * @param bool        $valid   Whether the phone number passed the default validation.
	 * @param string      $phone   The phone number being validated.
	 * @param string|null $country The country code the phone is being validated for, or null if unknown.
	 */
	return (bool) apply_filters( 'woocommerce_validate_phone', $valid, $phone, $country );
}