diff options
author | Nick Busey <nickabusey@gmail.com> | 2012-02-02 19:07:03 +0100 |
---|---|---|
committer | Nick Busey <nickabusey@gmail.com> | 2012-02-02 19:07:03 +0100 |
commit | 98c347de9f62a3427170f9f73a692d159765e8cf (patch) | |
tree | 53a136918d22b46871f3272e0cb0c7f5600319de /system/libraries/Form_validation.php | |
parent | b211adee89f5fd2192051e9c0826146bd150f469 (diff) |
Adding equal to greater than, equal to less than form validators.
Diffstat (limited to 'system/libraries/Form_validation.php')
-rw-r--r-- | system/libraries/Form_validation.php | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index 0a6a2af0d..1b2907a08 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -1116,7 +1116,7 @@ class CI_Form_validation { // -------------------------------------------------------------------- /** - * Greather than + * Greater than * * @param string * @return bool @@ -1131,6 +1131,24 @@ class CI_Form_validation { } // -------------------------------------------------------------------- + + /** + * Equal to or Greater than + * + * @access public + * @param string + * @return bool + */ + function equal_to_greater_than($str, $min) + { + if ( ! is_numeric($str)) + { + return FALSE; + } + return $str >= $min; + } + + // -------------------------------------------------------------------- /** * Less than @@ -1150,6 +1168,24 @@ class CI_Form_validation { // -------------------------------------------------------------------- /** + * Equal to or Less than + * + * @access public + * @param string + * @return bool + */ + function equal_to_less_than($str, $max) + { + if ( ! is_numeric($str)) + { + return FALSE; + } + return $str <= $max; + } + + // -------------------------------------------------------------------- + + /** * Is a Natural number (0,1,2,3, etc.) * * @param string |