summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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);
}
// --------------------------------------------------------------------