1 <?xml version="1.0" encoding="UTF-8"?>
3 <sect2 id="zend.validate.set.between">
7 <classname>Zend_Validate_Between</classname> allows you to validate if a given value is
8 between two other values.
12 <title>Zend_Validate_Between supports only number validation</title>
15 It should be noted that Zend_Validate_Between supports only the validation of numbers.
16 Strings or dates can not be validated with this validator.
20 <sect3 id="zend.validate.set.between.options">
21 <title>Supported options for Zend_Validate_Between</title>
24 The following options are supported for <classname>Zend_Validate_Between</classname>:
30 <emphasis><property>inclusive</property></emphasis>: Defines if the validation
31 is inclusive the minimum and maximum border values or exclusive. It defaults
32 to <constant>TRUE</constant>.
38 <emphasis><property>min</property></emphasis>: Sets the minimum border for the
45 <emphasis><property>max</property></emphasis>: Sets the maximum border for the
52 <sect3 id="zend.validate.set.between.basic">
53 <title>Default behaviour for Zend_Validate_Between</title>
56 Per default this validator checks if a value is between <property>min</property> and
57 <property>max</property> where both border values are allowed as value.
60 <programlisting language="php"><![CDATA[
61 $valid = new Zend_Validate_Between(array('min' => 0, 'max' => 10));
63 $result = $valid->isValid($value);
68 In the above example the result is <constant>TRUE</constant> due to the reason that per
69 default the search is inclusively the border values. This means in our case that any
70 value from '0' to '10' is allowed. And values like '-1' and '11' will return
71 <constant>FALSE</constant>.
75 <sect3 id="zend.validate.set.between.inclusively">
76 <title>Validation exclusive the border values</title>
79 Sometimes it is useful to validate a value by excluding the border values. See the
83 <programlisting language="php"><![CDATA[
84 $valid = new Zend_Validate_Between(
92 $result = $valid->isValid($value);
97 The example is almost equal to our first example but we excluded the border value. Now
98 the values '0' and '10' are no longer allowed and will return <constant>FALSE</constant>.