Skip to content

Instantly share code, notes, and snippets.

@YaronMiro
Created May 15, 2018 05:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YaronMiro/3dfac9ecbe3a8ffe476011f93cd04dbd to your computer and use it in GitHub Desktop.
Save YaronMiro/3dfac9ecbe3a8ffe476011f93cd04dbd to your computer and use it in GitHub Desktop.
PHP Israeli phone number validation
<?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