function fapi_validation_rule_length in Form API Validation 6
Same name and namespace in other branches
- 7.2 fapi_validation.module \fapi_validation_rule_length()
- 7 fapi_validation.module \fapi_validation_rule_length()
1 string reference to 'fapi_validation_rule_length'
- fapi_validation_fapi_validation_rules in ./
fapi_validation.module - Implementation of hook_fapi_validation_rules
File
- ./
fapi_validation.module, line 241
Code
function fapi_validation_rule_length($value, $params) {
$size = mb_strlen($value);
if (count($params) == 1) {
return $size == (int) $params[0];
}
else {
if (count($params) == 2) {
return $size >= (int) $params[0] && $size <= (int) $params[1];
}
}
}