I have just double checked the ZF2 reference guide and found this:

*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.

Does this mean decimal places too then?

Thanks



On 19 February 2013 23:11, Daniel Latter <[email protected]> wrote:

> Hi All,
>
> Does Zend\Validator\Digits support floats? i.e. validate TRUE for a given
> float?
>
> It's just if I pass 7.5, Digits returns false? but if I look at the
> isValid() method of the Digits class, the first thing it does are sanity
> checks, and one is:
>
> is_float($value)
>
> So we know that this will return false if a string is passed but I am
> passing 7.5 (not a string), so the checks pass.
>
> But later in the method Digits performs it's own filter on the value.
> After that a final comparison takes place and in my case 7.5 and 75 are
> being compared, which is false so the validation is failing?
>
> Forgive me if I have overlooked something (probably have)
>
> Thanks
> Daniel
>

Reply via email to