Validators/Number.php
Go to the documentation of this file.
1<?php
8
12class Number extends Validator
13{
21 public function validate($value, $parameters = array())
22 {
23 $min = isset($parameters['min']) ? $parameters['min'] : null;
24 $max = isset($parameters['max']) ? $parameters['max'] : null;
25
26 return is_numeric($value)
27 && (($value >= $min) || ($min === null))
28 && (($value <= $max) || ($max === null));
29 }
30}
default validator for number input elements
validate($value, $parameters=array())
number validation
Validators for HTML input-elements.