summaryrefslogtreecommitdiffstats
path: root/system/libraries
diff options
context:
space:
mode:
authorDerek Allard <derek.allard@ellislab.com>2008-01-22 20:40:05 +0100
committerDerek Allard <derek.allard@ellislab.com>2008-01-22 20:40:05 +0100
commit20460a6001f75c599aa3f4df1cf79b42ee2eb102 (patch)
tree57d525594fa2a46fe2fff47fba289497ea20a665 /system/libraries
parent9468f3ebe207f73aa5871b5eeca26184dbccbfd1 (diff)
modifications to numeric and integer validation
Diffstat (limited to 'system/libraries')
-rw-r--r--system/libraries/Validation.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/system/libraries/Validation.php b/system/libraries/Validation.php
index dc4e016bc..a3ce9808b 100644
--- a/system/libraries/Validation.php
+++ b/system/libraries/Validation.php
@@ -552,7 +552,8 @@ class CI_Validation {
*/
function numeric($str)
{
- return ( ! is_numeric($str)) ? FALSE : TRUE;
+ return (bool)preg_match( '/^[\-+]?[0-9]*\.?[0-9]+$/', $str);
+
}
// --------------------------------------------------------------------
@@ -566,7 +567,7 @@ class CI_Validation {
*/
function integer($str)
{
- return ( ! is_int($str)) ? FALSE : TRUE;
+ return (bool)preg_match( '/^[\-+]?[0-9]+$/', $str);
}
// --------------------------------------------------------------------