note 87602 deleted from function.is-int by danbrown

From: Date: Fri, 12 Dec 2008 16:13:28 +0000
Subject: note 87602 deleted from function.is-int by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-148077@lists.php.net to get a copy of this message
Note Submitter: Ben ---- Why bother type checking when your casting both sides as strings. Dont over-engineer it. <?php function another_is_int($a){ return ($a == (int) $a); } ?> # Don't over-engineer it. # # <?php # function another_is_int($a){ # return ((string) $a) === ((string)(int) $a); # } # ?>

« previous php.notes (#148077) next »