From 20460a6001f75c599aa3f4df1cf79b42ee2eb102 Mon Sep 17 00:00:00 2001 From: Derek Allard Date: Tue, 22 Jan 2008 19:40:05 +0000 Subject: modifications to numeric and integer validation --- system/libraries/Validation.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'system/libraries') 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); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b