I found it tricky to check if a posted value was an integer.
<?php
$_POST['a'] = "42";
is_int( $_POST['a'] ); //false
is_int( intval( "anything" ) ); //always true
?>
A method I use for checking if a string represents an integer value.
<?php
function check_int( $str )
{
return is_numeric( $str ) && intval( $str ) - $str == 0;
}
?>
----
Server IP: 202.89.58.1
Probable Submitter: 118.93.104.78
----
Manual Page -- http://www.php.net/manual/en/language.types.type-juggling.php
Edit -- https://master.php.net/note/edit/102737
Del: integrated -- https://master.php.net/note/delete/102737/integrated
Del: useless -- https://master.php.net/note/delete/102737/useless
Del: bad code -- https://master.php.net/note/delete/102737/bad+code
Del: spam -- https://master.php.net/note/delete/102737/spam
Del: non-english -- https://master.php.net/note/delete/102737/non-english
Del: in docs -- https://master.php.net/note/delete/102737/in+docs
Del: other reasons-- https://master.php.net/note/delete/102737
Reject -- https://master.php.net/note/reject/102737
Search -- https://master.php.net/manage/user-notes.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.