function arrayCheck()
Run a validation check against each value in an array.
Behaviour is very similar to the Validator::check method.
Only supports single-depth arrays
Errors are put into the field_errors array under a subkey matching the array key
Return value is an array of key => boolean with the validation result for each key Usagearray $Validator->arrayCheck ( string $field_name , callable $func ); Example$data = ['vals' => [1, 2, 'A', 'B', 5]];
$validator = new Validator($data);
$result = $validator->arrayCheck('vals', 'Validity::positiveInt');
// $result now contains [true, true, false, false, true]
$errs = $validator->getFieldErrors();
// $errs now contains [ 'vals' => [2 => [...], 3 => [...]] ] Arguments- string $field_name
The field to check - callable $func
The function or method to call.
Return value
|