note 15694 added to function.is-int

From: Date: Thu, 27 Sep 2001 02:45:39 +0000
Subject: note 15694 added to function.is-int
Groups: php.notes php.notes 
Request: Send a blank email to php-notes+get-18350@lists.php.net to get a copy of this message
A much better way of addressing the ID problem is as follows: function valid_id($id) { if (strval(intval($id)) === $id) return true; else return false; } This will not allow entries like "12." or a blank entry. It will allow positive or negative integers. You can disallow negative integers by adding " && $id >= 0" to the if expression. -- http://www.php.net/manual/en/function.is-int.php http://master.php.net/manage/user-notes.php?action=edit+15694 http://master.php.net/manage/user-notes.php?action=delete+15694 http://master.php.net/manage/user-notes.php?action=reject+15694

« previous php.notes (#18350) next »