note 38647 added to function.is-string
| From: | ajones74 at gimme-spam at yahoo dot com | Date: | Wed, 31 Dec 2003 21:33:34 +0000 |
| Subject: | note 38647 added to function.is-string | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-62732@lists.php.net to get a copy of this message | ||
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.
----
Manual Page -- http://www.php.net/manual/en/function.is-string.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+38647
Delete -- http://master.php.net/manage/user-notes.php?action=delete+38647&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+38647&report=yes
Search -- http://master.php.net/manage/user-notes.php