From: x2000habouzit Date: Sun, 23 Jul 2006 12:14:49 +0000 (+0000) Subject: avoid preg_match, use is_numeric X-Git-Tag: xorg/0.9.11~322 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=29e515ed108447dc76fa2783e711f762d59429c5;p=platal.git avoid preg_match, use is_numeric git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@583 839d8a87-29fc-0310-9880-83ba4fa771e5 --- diff --git a/classes/Env.php b/classes/Env.php index 6a7b2ac..23ebd50 100644 --- a/classes/Env.php +++ b/classes/Env.php @@ -66,7 +66,7 @@ class Env function i($key, $default = 0) { $i = Env::_get($key, $default); - return preg_match(',^[0-9]+$,', $i) ? intval($i) : $default; + return is_numeric($i) ? intval($i) : $default; } // }}} @@ -120,7 +120,7 @@ class Post function i($key, $default = 0) { $i = Post::_get($key, $default); - return preg_match(',^[0-9]+$,', $i) ? intval($i) : $default; + return is_numeric($i) ? intval($i) : $default; } // }}} @@ -173,7 +173,7 @@ class Get function i($key, $default = 0) { $i = Get::_get($key, $default); - return preg_match(',^[0-9]+$,', $i) ? intval($i) : $default; + return is_numeric($i) ? intval($i) : $default; } // }}} @@ -226,7 +226,7 @@ class Cookie function i($key, $default = 0) { $i = Cookie::_get($key, $default); - return preg_match(',^[0-9]+$,', $i) ? intval($i) : $default; + return is_numeric($i) ? intval($i) : $default; } // }}}