note 35922 added to function.constant
| From: | VGR_experts_exchange at edainworks dot com | Date: | Fri, 19 Sep 2003 09:32:21 +0000 |
| Subject: | note 35922 added to function.constant | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-56748@lists.php.net to get a copy of this message | ||
Hello. This applies to constants being defined as Boolean values, and may-be applies generally.
I advise you to NOT use this in an included file, in a function or elsewhere outside the scope where
the define('TRACE',TRUE) is placed) :
if (TRACE) {}
This will always evaluate to TRUE if the constant is not defined previously (the story about this
becoming an string 'TRACE', thus evaluating to TRUE)
Use this :
if ((defined('TRACE'))AND(constant('TRACE'))) {}
----
Manual Page -- http://www.php.net/manual/en/function.constant.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+35922
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35922&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35922&report=yes