utilityValidateInArray

Validates that a variable is in a pre-defined array of values. The value can be any valid array value. The validation array should be a simple array - not a nested array (but you can validate nested arrays e.g. does a nested array match a defined nested array). For strict checks (i.e. object properties or arrays) set the option STRICT_CHECK to true.

// validate that a variable is one of the values
$oValidator = new utilityValidateInArray(
    array(
        utilityValidateInArray::VALID_VALUES => array(1, 2, 3, 4, 5, 6),
    )
);
if ( !$oValidator->isValid(45) ) {
    print_r($oValidator->getMessages());
}

Methods


Inherited Methods

<  1  >