note 48386 deleted from function.is-int by tularis

From: Date: Tue, 21 Dec 2004 18:32:18 +0000
Subject: note 48386 deleted from function.is-int by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-82140@lists.php.net to get a copy of this message
Note Submitter: matt@bnm ---- Be aware... if you are using is_int() on posted form data if will ALWAYS return false (even if the data is actually an int). If you know a field will always be a number and need to test for is_int you have to do the following: if(is_int($_POST['form_field'] + 0)): // do something endif; Took me a while to work this one out!! Then suddenly remembered MySQL has similar quirks in some of it's functions. I assume $_GET vars are same, but not tested. ---- Reason: useless example

« previous php.notes (#82140) next »