WC_Validation::is_phone( string $phone )
Validates a phone number using a regular expression.
Description Description
Parameters Parameters
- $phone
-
(Required) Phone number to validate.
Return Return
(bool)
Source Source
File: includes/class-wc-validation.php
32 33 34 35 36 37 38 | public static function is_phone( $phone ) { if ( 0 < strlen ( trim( preg_replace( '/[\s\#0-9_\-\+\/\(\)\.]/' , '' , $phone ) ) ) ) { return false; } return true; } |