note 36901 deleted from function.is-numeric by nlopess
| From: | nlopess@php.net | Date: | Tue, 13 Jan 2004 14:50:42 +0000 |
| Subject: | note 36901 deleted from function.is-numeric by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-63430@lists.php.net to get a copy of this message | ||
Note Submitter: ste@REMOVEgolden.net
----
It's important to test for is_numeric() before empty() - if the variable is 0 is will be
considered empty and never make it to the is_numeric test.
i.e.
$x=0;
if (empty($x))
print "$x is empty";
else if (is_numeric($x))
print "$x is numeric";
You will never see "0 is numeric", only "0 is empty".
This note is on the empty() page but I thought it should be noted here.