Php universal function set (3 ). Function name: CheckTelephone ($ C_telephone) function: determines whether the phone number is valid. parameter: $ C_telephone (phone number to be detected) return value: Boolean value remarks: // Function name: checkTelephone ($ C_telephone)
// Usage: determines whether the phone number is a legal phone number.
// Parameter: $ C_telephone (phone number to be detected)
// Return value: Boolean
// Standby Note: None
// Configure //-----------------------------------------------------------------------------------
-------
Function CheckTelephone ($ C_telephone)
{
If (! Ereg ("^ [+]? [0-9] + ([xX-] [0-9] +) * $ ", $ C_telephone) return false;
Return true;
}
// Configure //-----------------------------------------------------------------------------------
-------
// Configure //-----------------------------------------------------------------------------------
-------
// Function name: CheckValueBetween ($ N_var, $ N_val1, $ N_val2)
// Usage: determines whether the value is valid within a certain range.
// Parameter: $ N_var value to be detected
// $ N_var1 upper limit of the value to be detected
// $ N_var2 lower limit of the value to be detected
// Return value: Boolean
// Standby Note: None
// Configure //-----------------------------------------------------------------------------------
-------
Function CheckValueBetween ($ N_var, $ N_val1, $ N_val2)
{
If ($ N_var <$ N_var1 │ $ N_var> $ N_var2)
{
Return false;
}
Return true;
}
// Configure //-----------------------------------------------------------------------------------
-------
// Configure //-----------------------------------------------------------------------------------
-------
// Function name: CheckPost ($ C_post)
// Usage: Determine whether the zip code is valid (fixed length)
// Parameter: $ C_post (zip code to be checked)
// Return value: Boolean
// Standby Note: None
// Configure //-----------------------------------------------------------------------------------
-------
Function CheckPost ($ C_post)
{
$ C_post = trim ($ C_post );
If (strlen ($ C_post) = 6)
{
If (! Ereg ("^ [+]? [_ 0-9] * $ ", $ C_post ))
{
Return true ;;
} Else
{
Return false;
}
} Else
{
Return false ;;
}
}
// Configure //-----------------------------------------------------------------------------------
-------
// Configure //-----------------------------------------------------------------------------------
-------
Http://www.bkjia.com/PHPjc/532630.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/532630.htmlTechArticle// function name: CheckTelephone ($ C_telephone) // used: determines whether it is a legal phone number // parameter: $ C_telephone (phone number to be detected) // return value: boolean // standby note :...