|
Size: | 10622 |
Storage flags: | no_autoload,compress/gzip (30%) |
Zend\Validator\Digits validates if a given value contains only digits.
There are no additional options for Zend\Validator\Digits:
To validate if a given value contains only digits and no other characters, simply call the validator like shown in this example:
1 2 3 4 5 | $validator = new Zend\Validator\Digits();
$validator->isValid("1234567890"); // returns true
$validator->isValid(1234); // returns true
$validator->isValid('1a234'); // returns false
|
Note
Validating numbers
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 Zend\I18n\Validator\Int or Zend\I18n\Validator\Float.
The source code of this file is hosted on GitHub. Everyone can update and fix errors in this document with few clicks - no downloads needed.