note 107419 added to language.types.type-juggling
| From: | Anonymous | Date: | Tue, 07 Feb 2012 18:31:55 +0000 |
| Subject: | note 107419 added to language.types.type-juggling | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-185899@lists.php.net to get a copy of this message | ||
namaroulis stated "I found it tricky to check if a posted value was an integer"; to test
if a variable is a number or a numeric string (such as form input, which is always a string), you
must use is_numeric():
<?php
$_POST['a'] = "42";
is_numeric( $_POST['a'] ); // true
?>
----
Server IP: 69.147.83.197
Probable Submitter: 72.219.151.91
----
Manual Page -- http://www.php.net/manual/en/language.types.type-juggling.php
Edit -- https://master.php.net/note/edit/107419
Del: integrated -- https://master.php.net/note/delete/107419/integrated
Del: useless -- https://master.php.net/note/delete/107419/useless
Del: bad code -- https://master.php.net/note/delete/107419/bad+code
Del: spam -- https://master.php.net/note/delete/107419/spam
Del: non-english -- https://master.php.net/note/delete/107419/non-english
Del: in docs -- https://master.php.net/note/delete/107419/in+docs
Del: other reasons-- https://master.php.net/note/delete/107419
Reject -- https://master.php.net/note/reject/107419
Search -- https://master.php.net/manage/user-notes.php