Home > Backend Development > PHP Tutorial > PHP general detection function set (3)_PHP tutorial

PHP general detection function set (3)_PHP tutorial

WBOY
Release: 2016-07-13 17:19:54
Original
830 people have browsed it

// Function name: CheckTelephone($C_telephone)
// Function: Determine whether it is a legal phone number
// Parameter: $C_telephone (the phone number to be detected)
// Return value: Boolean value
//Remarks: None
//---------------------------------------- ---------------------------------------------
-- -----
function CheckTelephone($C_telephone)
{
if (!ereg("^[+]?[0-9]+([xX-][0-9]+) *$", $C_telephone)) return false;
return true;
}
//------------------------ -------------------------------------------------- ----------
-------


//-------------------- -------------------------------------------------- -------------
-------
// Function name: CheckValueBetween($N_var, $N_val1, $N_val2)
// Function: Judgment Whether it is a legal value within a certain range
// Parameters: $N_var The value to be detected
// $N_var1 The upper limit of the value to be detected
// $N_var2 The lower limit of the value to be detected
/ / Return value: Boolean value
// Remarks: None
//---------------------------------- -------------------------------------------------- --
-------
function CheckValueBetween($N_var, $N_val1, $N_val2)
{
if ($N_var < $N_var1 ││ $N_var > $N_var2 )
{
return false;
}
return true;

}
//----------------- -------------------------------------------------- ----------------
-------


//------------- -------------------------------------------------- --------------------
-------
// Function name: CheckPost($C_post)
// Function: Determine whether it is a legal postal code (fixed length)
// Parameter: $C_post (postal code to be checked)
// Return value: Boolean value
// Remarks: None
//-- -------------------------------------------------- -------------------------------
-------
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;;
}
}
//----------------------------- -------------------------------------------------- ---
-------


//-------------------------- -------------------------------------------------- -------
-------

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/532630.htmlTechArticle// Function name: CheckTelephone($C_telephone) // Function: Determine whether it is a legal phone number // Parameters: $C_telephone (phone number to be detected) // Return value: Boolean // Remarks:...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template