note 13097 deleted from function.is-numeric by nlopess

From: Date: Sun, 16 Jan 2005 12:40:18 +0000
Subject: note 13097 deleted from function.is-numeric by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-83433@lists.php.net to get a copy of this message
Note Submitter: ASkwar at DigitalProjects dot com ---- Someone wanted to know how to check if a val is numeric in PHP3. Here's my take: $val = -123.45E293; $match = '^-?\d+(?:\.\d+)?(?:[Ee]-?\d+)$'; if (preg_match('|' . $match . '|', $val)){ echo $val . ' is a number!'; } else { echo $val . ' is not a number!'; }

« previous php.notes (#83433) next »