php通用检测函数集(3)
核心提示:PHP编程,PHP教程,PHP5教程,PHP开发
//函数名:CheckTelephone($C_telephone) //作用:判定是否是为正当电话号码 //参数:$C_telephone(待检测的电话号码) //返回值:布尔值 //备注:无 //----------------------------------------------------------------------------------- ------- functionCheckTelephone($C_telephone) { if(!ereg("^[+]?[0⑼]+([xX-][0⑼]+)*$",$C_telephone))returnfalse; returntrue; } //----------------------------------------------------------------------------------- ------- //----------------------------------------------------------------------------------- ------- //函数名:CheckValueBetween($N_var,$N_val1,$N_val2) //作用:判定是否是是某1范围内的正当值 //参数:$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⑼]*$",$C_post)) { returntrue;; }else { returnfalse; } }else { returnfalse;; } } //----------------------------------------------------------------------------------- ------- |
TAG:作用,参数,函数,电话号码,备注
评论加载中...
|
上一篇: Windows缓存写进失败故障分析
下一篇: ASP 3.0高级编程(4106)