SPHPlayground API
SPHPlayground
sphplayground sphplayground

Validating numeric data

These validators validate float and int data

  1. SmallerThan is lower bound validator: the length of the input must be atleast a given limit.
  2. GreaterThan is upper bound validator: the length of the input must be below a given limit.
  3. Between validator: value must be between the lower and upper limits.

Predefined errormessage Template formatting parameters:

  1. :value - the string representation of the validated $value
  2. :type - the datatype of the validated $value
    1. :type = "boolean" - for boolean type
    2. :type = "integer" - for integer type
    3. :type = "float" - for float type
    4. :type = "string" - for string type
    5. :type = "array" - for array type
    6. :type = "object" - for object type
    7. :type = "resource" - for resource type
    8. :type = "resource (closed)" - for closed resource type
    9. :type = "NULL" - for nulls
    10. :type = "unknown type" - for unknown types
  3. :strict-type - the strict datatype of the validated $value differs from :type
    1. any object corresponds to the name of the class get_class() results

The Between validator

The Between validator validates whether numeric input is between two numbers. This range is either inclusive or exclusive.

Validator specific predefined errormessage Template formatting parameters:

  1. :min - the minumum allowed value of the validated $value
  2. :max - the maximum allowed value of the validated $value
Synopsis

class Between

The SmallerThan validator

The SmallerThan validator validates whether a float or an int input is msaller than or equal to a treshold value.

Validator specific predefined errormessage Template formatting parameters:

  1. :max - the maximum allowed value of the validated $value
Synopsis

class SmallerThan

The GreaterThan validator

The GreaterThan validator validates whether a float or an int input is greater than or equal to a treshold value.

Validator specific predefined errormessage Template formatting parameters:

  1. :min - the minumum allowed value of the validated $value
Synopsis

class GreaterThan