判断是否为指定长度内字符串的php函数


复制代码 代码如下:

//———————————————————————————–
// 函数名:CheckLengthBetween($C_char, $I_len1, $I_len2=100)
// 作 用:判断是否为指定长度内字符串
// 参 数:$C_char(待检测的字符串)
// $I_len1 (目标字符串长度的下限)
// $I_len2 (目标字符串长度的上限)
// 返回值:布尔值
// 备 注:无
//———————————————————————————–
function CheckLengthBetween($C_cahr, $I_len1, $I_len2=100)
{
$C_cahr = trim($C_cahr);
if (strlen($C_cahr) < $I_len1) return false;
if (strlen($C_cahr) > $I_len2) return false;
return true;
}
//———————————————————————————–

« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3