PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

GreaterThan

Zend_Validate_GreaterThan allows you to validate if a given value is greater than a minimum border value.

Zend_Validate_GreaterThan supports only number validation

It should be noted that Zend_Validate_GreaterThan supports only the validation of numbers. Strings or dates can not be validated with this validator.

Supported options for Zend_Validate_GreaterThan

The following options are supported for Zend_Validate_GreaterThan:

  • min: Sets the minimum border value.

Basic usage

To validate if a given value is greater than a defined border simply use the following example.

<?php
$valid  
= new Zend_Validate_GreaterThan(array('min' => 10));
$value  11;
$return $valid->isValid($value);
// returns true

The above example returns TRUE for all values which are greater than 10.

<?php
$valid  
= new Zend_Validate_GreaterThan(array('min' => 10));
$value  10;
$return $valid->isValid($value);
// returns false

The above example returns FALSE for all values which are lesser or equal to the minimum border value.

Zend Framework