WC_Validation::is_phone()public staticWC 1.0

Validates a phone number using a regular expression.

Method of the class: WC_Validation{}

No Hooks.

Return

true|false.

Usage

$result = WC_Validation::is_phone( $phone );
$phone(string) (required)
Phone number to validate.

WC_Validation::is_phone() code WC 9.4.2

public static function is_phone( $phone ) {
	if ( 0 < strlen( trim( preg_replace( '/[\s\#0-9_\-\+\/\(\)\.]/', '', $phone ) ) ) ) {
		return false;
	}

	return true;
}