note 38647 deleted from function.is-string by nlopess
| From: | nlopess@php.net | Date: | Thu, 01 Jan 2004 16:23:06 +0000 |
| Subject: | note 38647 deleted from function.is-string by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-62746@lists.php.net to get a copy of this message | ||
Note Submitter: ajones74@gimme-spam@yahoo.com
----
Beware, "is_string()" will not detect strings of zero length, eg:
$foo = "";
if (is_string($foo)) {
echo "foo IS a string!";
} else {
echo "foo is NOT a string!";
}
Much to my surprise, I would see "foo IS a string!".
I found that trying to detect "strings of zero bytes" are best determined
using 'if ($foo === "")' AND 'if ($foo == "")' types of
tests.