Chamilo is a learning management system focused on ease of use and accessibility
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
chamilo-lms/main/inc/lib/formvalidator/Rule/MobilePhoneNumber.php

26 lines
585 B

<?php
/**
* Abstract base class for QuickForm validation rules
*/
/**
* Validate telephones
*
*/
class HTML_QuickForm_Rule_Mobile_Phone_Number extends HTML_QuickForm_Rule
{
/**
* Validates mobile phone number
*
* @param string Mobile phone number to be validated
* @param string Not using it. Just to respect the declaration
* @return boolean Returns true if valid, false otherwise.
*/
function validate($mobilePhoneNumber, $options = null)
{
$rule = "/^\d{11}$/";
return preg_match($rule, $mobilePhoneNumber);
}
}