note 40424 added to function.is-int

From: Date: Wed, 03 Mar 2004 14:13:03 +0000
Subject: note 40424 added to function.is-int
Groups: php.notes 
Request: Send a blank email to php-notes+get-66168@lists.php.net to get a copy of this message
I've noticed, that is_int() will NOT recognise integers set as strings: $var = "10"; OR $var = $_POST['someint']; is_int($var) returns allways "false"! to check, if a string-argument is an integer, you have to evaluate it to a new var. without "" (brackets) @eval("\$try_int = $var;"); then check if $try_int is an integer... is_int($try_int) -> will return "TRUE" (if $var was realy an int)! NOTE: eval() will couse an php-warning/error, if the $var is NOT an integer -> therefore an "@" ---- Manual Page -- http://www.php.net/manual/en/function.is-int.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+40424 Delete -- http://master.php.net/manage/user-notes.php?action=delete+40424&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+40424&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#66168) next »