Created
May 15, 2018 05:08
-
-
Save YaronMiro/3dfac9ecbe3a8ffe476011f93cd04dbd to your computer and use it in GitHub Desktop.
PHP Israeli phone number validation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ValidationsService { | |
public static function isValidPhoneNumber($val) { | |
$pattern = "/^((\+972|972)|0)( |-)?([1-468-9]( |-)?\d{7}|(5|7)[0-9]( |-)?\d{7})$/"; | |
return preg_match($pattern, $val); | |
} | |
} | |
? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment