views:

44

answers:

1

Any workaround to validate an int field which exceeds PHP_INT_MAX (2147483647 on 32 bit) value? The code I am using in Zend framework is:

'int_input' => array(
        'allowEmpty' => true,
        'Zend_Validate_Int',
        array('Zend_Validate_Between',0,4000000000),
        'message' => 'Int must be between 1 and 4,000,000,000.'
    )

Thanks.

+1  A: 

Technically no, because it's not a PHP Integer if it's out of bounds.

But you can use Zend_Validate_Digits with Zend_Validate_Between to make sure the passed value is a number in a specific range though.

Gordon
Thanks Gordon, that's exactly what I was looking for. The 'Zend_Validate_Digit' should be 'Zend_Validate_Digits'?
pMan
@pMan yes, Digits. Thanks. Fixed.
Gordon