Execute a single validation rule and return its result.
public static validateRule ( mixed $Value, string $FieldName, string | array $Rule, string $CustomError = false ) : boolean | string | ||
$Value | mixed | The value to validate. |
$FieldName | string | The name of the field to put into the error result. |
$Rule | string | array | The rule to validate which can be one of the following.
- string: The name of a function used to validate the value.
- 'regex: |
$CustomError | string | A custom error message. |
return | boolean | string | One of the following - TRUE: The value passed validation. - string: The error message associated with the error. |