note 89120 rejected from language.constants by thiago
| From: | thiago@php.net | Date: | Mon, 23 Feb 2009 14:57:30 +0000 |
| Subject: | note 89120 rejected from language.constants by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-151015@lists.php.net to get a copy of this message | ||
Note Submitter: totte at monkisoft dot com
----
I found that the following don't work as expected with a constant
define("MY_CONST", false);
if(defined(MY_CONST) && MY_CONST == false)
{
.. do this;
}
else
{
.. do this
.. to get here, MY_CONST is not defined OR const is defined and true
}
The above simple logic don't work! Seems one have to rewrite it as
if(!defined(MY_CONST) || (MY_CONST == true)
{
.. do this
.. to get here, MY_CONST is not defined OR const is defined and true
}else
{
.. do this;
}
Thanks,
totte