note 28572 added to function.intval

From: Date: Fri, 17 Jan 2003 06:04:12 +0000
Subject: note 28572 added to function.intval
Groups: php.notes 
Request: Send a blank email to php-notes+get-42252@lists.php.net to get a copy of this message
This is a little more explicit and won't break when the value can't be legally cast as an int function is_intValued($var) { // Determines if a variable's value is an integer regardless of type // meant to be an analogy to PHP's is_numeric() if (is_int($var)) return TRUE; if (is_string($var) and $var === (string)(int) $var) return TRUE; if (is_float($var) and $var === (float)(int) $var) return TRUE; else return FALSE; } -- http://www.php.net/manual/en/function.intval.php http://master.php.net/manage/user-notes.php?action=edit+28572 http://master.php.net/manage/user-notes.php?action=delete+28572 http://master.php.net/manage/user-notes.php?action=reject+28572

« previous php.notes (#42252) next »