note 31797 added to function.define
| From: | brentonb at rack1 dot php dot net | Date: | Sun, 04 May 2003 04:50:03 +0000 |
| Subject: | note 31797 added to function.define | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-47484@lists.php.net to get a copy of this message | ||
Just a note when it comes to defining booleans ... if you have a condition where a constant will be
defined as a true, but no else to define it as false ... it will still 'technically' be
true ... example:
if ($is_popup)
{
define ("POPUP", TRUE);
}
used anywhere else such as:
if (POPUP)
{
// blah blah
}
will always execute. You can see this in the fact that if you print out POPUP:
echo (POPUP);
it will either print: "POPUP" or "TRUE" .. therefore, it's still
"technically" true
This one had me stumped for a while .. I suggest either putting in the else part:
else
{
define ("POPUP", FALSE);
}
or using the defined () function.
--
http://www.php.net/manual/en/function.define.php
http://master.php.net/manage/user-notes.php?action=edit+31797
http://master.php.net/manage/user-notes.php?action=delete+31797
http://master.php.net/manage/user-notes.php?action=reject+31797