note 28572 deleted from function.intval by didou

From: Date: Thu, 06 Nov 2003 14:03:03 +0000
Subject: note 28572 deleted from function.intval by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-59991@lists.php.net to get a copy of this message
Note Submitter: php.net@davidmcarthur.com ---- 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; }

« previous php.notes (#59991) next »