note 91633 deleted from function.is-int by danbrown

From: Date: Sat, 20 Jun 2009 17:22:36 +0000
Subject: note 91633 deleted from function.is-int by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-157181@lists.php.net to get a copy of this message
Note Submitter: Anonymous ---- Anonymous's 3-Jun note was on the right track by not typecasting, but didn't work for 0, "0", "00", -1... A slight variation of Mark's 26-Jun note is the best yet: <?php function really_is_integer($val) { return ((preg_match('/^[-]?[0-9]+$/', $val) === 1) and !is_bool($val)); } ?>

« previous php.notes (#157181) next »