Home  >  Article  >  Backend Development  >  PHP function to determine whether it is a string within a specified length_PHP tutorial

PHP function to determine whether it is a string within a specified length_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:41:04904browse

Copy code The code is as follows:

//—————————————————— ————————–
// Function name: CheckLengthBetween($C_char, $I_len1, $I_len2=100)
// Function: Determine whether it is a string within the specified length
// Parameters: $C_char (string to be detected)
// $I_len1 (lower limit of target string length)
// $I_len2 (upper limit of target string length)
// Return value: Boolean Value
//Remarks: None
//——————————————————————————————–
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;
}
//———————————————————————— ———–

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/321254.htmlTechArticleCopy the code as follows: //———————————————— ——————————– // Function name: CheckLengthBetween($C_char, $I_len1, $I_len2=100) /...
Statement:
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