You are here

function fapi_validation_rule_chars in Form API Validation 7.2

Same name and namespace in other branches
  1. 6 fapi_validation.module \fapi_validation_rule_chars()
  2. 7 fapi_validation.module \fapi_validation_rule_chars()
1 string reference to 'fapi_validation_rule_chars'
fapi_validation_fapi_validation_rules in ./fapi_validation.module
Implementation of hook_fapi_validation_rules

File

./fapi_validation.module, line 312

Code

function fapi_validation_rule_chars($value, $params) {
  for ($i = 0; $i < mb_strlen($value); $i++) {
    $current = substr($value, $i, 1);
    if (!in_array($current, $params)) {
      return FALSE;
    }
  }
  return TRUE;
}