首页 > 开发 > PHP > 正文

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

2024-05-04 22:10:03
字体:
来源:转载
供稿:网友
代码如下:
//———————————————————————————–
// 函数名: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;
}
//———————————————————————————–
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表