File: Zend_Validate-Digits.xml

package info (click to toggle)
zendframework 1.12.9%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 133,584 kB
  • sloc: xml: 1,311,829; php: 570,173; sh: 170; makefile: 125; sql: 121
file content (46 lines) | stat: -rw-r--r-- 1,586 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?xml version="1.0" encoding="UTF-8"?>
<!-- Reviewed: no -->
<sect2 id="zend.validate.set.digits">
    <title>Digits</title>

    <para>
        <classname>Zend_Validate_Digits</classname> validates if a given value contains only digits.
    </para>

    <sect3 id="zend.validate.set.digits.options">
        <title>Supported options for Zend_Validate_Digits</title>

        <para>
            There are no additional options for <classname>Zend_Validate_Digits</classname>:
        </para>
    </sect3>

    <sect3 id="zend.validate.set.digits.basic">
        <title>Validating digits</title>

        <para>
            To validate if a given value contains only digits and no other characters, simply call
            the validator like shown in this example:
        </para>

        <programlisting language="php"><![CDATA[
$validator = new Zend_Validate_Digits();

$validator->isValid("1234567890"); // returns true
$validator->isValid(1234);         // returns true
$validator->isValid('1a234');      // returns false
]]></programlisting>

        <note>
            <title>Validating numbers</title>

            <para>
                When you want to validate numbers or numeric values, be aware that this validator
                only validates digits. This means that any other sign like a thousand separator or
                a comma will not pass this validator. In this case you should use
                <classname>Zend_Validate_Int</classname> or
                <classname>Zend_Validate_Float</classname>.
            </para>
        </note>
    </sect3>
</sect2>