MobilePhoneNumber.php 585 B

1234567891011121314151617181920212223242526
  1. <?php
  2. /**
  3. * Abstract base class for QuickForm validation rules
  4. */
  5. /**
  6. * Validate telephones
  7. *
  8. */
  9. class HTML_QuickForm_Rule_Mobile_Phone_Number extends HTML_QuickForm_Rule
  10. {
  11. /**
  12. * Validates mobile phone number
  13. *
  14. * @param string Mobile phone number to be validated
  15. * @param string Not using it. Just to respect the declaration
  16. * @return boolean Returns true if valid, false otherwise.
  17. */
  18. function validate($mobilePhoneNumber, $options = null)
  19. {
  20. $rule = "/^\d{11}$/";
  21. return preg_match($rule, $mobilePhoneNumber);
  22. }
  23. }