WC_Validation::is_phone
Validates a phone number using a regular expression.
Method of the class: WC_Validation{}
No Hooks.
Returns
true|false.
Usage
$result = WC_Validation::is_phone( $phone );
- $phone(string) (required)
- Phone number to validate.
WC_Validation::is_phone() WC Validation::is phone code WC 10.5.0
public static function is_phone( $phone ) {
if ( 0 < strlen( trim( preg_replace( '/[\s\#0-9_\-\+\/\(\)\.]/', '', $phone ) ) ) ) {
return false;
}
return true;
}