<?php
function validateLength($string, $minlength=5, $maxlength=30)
{
if (strlen($string) >= $minlength && strlen($string) <= $maxlength)
return true;
return false;
}
?>
Usage
$string - (str) the string you wish to validate.
$minlength - (int) set to 0 for no minimum length.
$maxlength - (int) sets the maximum valid length of the string
Boolean return
Usage
$string - (str) the string you wish to validate.
$minlength - (int) set to 0 for no minimum length.
$maxlength - (int) sets the maximum valid length of the string
Boolean return
0 comments:
Post a Comment