当前位置: 首页 > 图文教程 > 网络编程 > PHP > php通用检测函数集(3)

PHP
第十三节--对象串行化 -- Classes and Objects in PHP5 [13]
第十一节--重载 -- Classes and Objects in PHP5 [11]
第十节--抽象方法和抽象类 -- Classes and Objects in PHP5 [10]
第九节--绑定 -- Classes and Objects in PHP5 [9]
第八节--访问方式 -- Classes and Objects in PHP5 [8]
第七节--类的静态成员 -- Classes and Objects in PHP5 [7]
第六节--访问属性和方法 -- Classes and Objects in PHP5 [6]
第五节--克隆 -- Classes and Objects in PHP5 [5]
第四节--构造函数和析构函数 -- Classes and Objects in PHP5 [4
第三节--定义一个类 -- Classes and Objects in PHP5 [3]
第二节--PHP5 的对象模型 -- Classes and Objects in PHP5 [2]
第一节--面向对象编程 -- Classes and Objects in PHP5 [1]
初探 PHP5 (二)
初探 PHP5 (一)
SSI使用详解(二)
SSI使用详解(一)
Cookie及其使用(二)
Cookie及其使用(一)
实现跨域名Cookie
两种统计当前在线人数的方法

PHP 中的 php通用检测函数集(3)


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-08-14   浏览: 117 ::
收藏到网摘: n/a


//函数名:CheckTelephone($C_telephone)
//作用:判断是否为合法电话号码
//参数:$C_telephone(待检测的电话号码)
//返回值:布尔值
//备注:无
//-----------------------------------------------------------------------------------
-------
functionCheckTelephone($C_telephone)
{
if(!ereg("^[+]?[0-9]+([xX-][0-9]+)*$",$C_telephone))returnfalse;
returntrue;
}
//-----------------------------------------------------------------------------------
-------


//-----------------------------------------------------------------------------------
-------
//函数名:CheckValueBetween($N_var,$N_val1,$N_val2)
//作用:判断是否是某一范围内的合法值
//参数:$N_var待检测的值
//$N_var1待检测值的上限
//$N_var2待检测值的下限
//返回值:布尔值
//备注:无
//-----------------------------------------------------------------------------------
-------
functionCheckValueBetween($N_var,$N_val1,$N_val2)
{
if($N_var<$N_var1││$N_var>$N_var2)
{
returnfalse;
}
returntrue;

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


//-----------------------------------------------------------------------------------
-------
//函数名:CheckPost($C_post)
//作用:判断是否为合法邮编(固定长度)
//参数:$C_post(待check的邮政编码)
//返回值:布尔值
//备注:无
//-----------------------------------------------------------------------------------
-------
functionCheckPost($C_post)
{
$C_post=trim($C_post);
if(strlen($C_post)==6)
{
if(!ereg("^[+]?[_0-9]*$",$C_post))
{
returntrue;;
}else
{
returnfalse;
}
}else
{
returnfalse;;
}
}
//-----------------------------------------------------------------------------------
-------