note 14019 added to functions.php
| From: | clueless at one2one-networks dot com | Date: | Fri, 13 Jul 2001 16:34:05 +0000 |
| Subject: | note 14019 added to functions.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-15331@lists.php.net to get a copy of this message | ||
In the above example (by bart@framers.nl), the question is (indirectly) posed of how to
differentiate "" and 0 from the boolean true and false. PHP does this with the !== and
=== operators. These check for both (in)equality on value AND type.
So the example code could read
if (($somevar = foo()) !== false) {
do_something_on_success();
}
and it would work as wanted (only in PHP 4, though).
This is documented in language.operators.comparison.php so I suppose no real reason to write this
note :-)
/Troels Therkelsen
clueless@one2one-networks.com
http://www.php.net/manual/en/functions.php