orodjq
Last Updated: February 25, 2016
·
543
· gjerokrsteski
F8c4fdde8545731ac4a77b52e4896595

Create a factory of rules with Pimf_Util_Validator

 $attributes = array(
  'fname'    => 'conan',
  'age'      => 33,
  'birth'    => '12-12-2040',
  'monitor'  => 'sonyT2000',
);

$rules = array(
  'fname'   => 'alpha|length[>,0]|lengthBetween[1,9]',
  'age'     => 'digit|value[>,18]|value[=,33]',
  'birth'   => 'length[>,0]|date[mm-dd-yyyy]',
  'monitor' => 'alphaNumeric'
);

$validator = Pimf_Util_Validator::factory($attributes, $rules);

 //...
$validator->getErrors();
$validator->getErrorMessages();
Say Thanks
Respond