note 26147 added to function.constant
| From: | PHPdotNET Hollemans | Date: | Sat, 19 Oct 2002 19:02:15 +0000 |
| Subject: | note 26147 added to function.constant | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-38306@lists.php.net to get a copy of this message | ||
If the string <name> is not (yet) registered as a constant, it will return false and generate
a Warning (Couldn't find constant <name> in <file> on line <line nr>).
This can be used in a construction to avoid a file from being executed twice:
if ( ! @constant ( "<file_id>" ) ) {
define ( "<file_id>", true );
<statements>
<functions>
<other code>
}
--
http://www.php.net/manual/en/function.constant.php
http://master.php.net/manage/user-notes.php?action=edit+26147
http://master.php.net/manage/user-notes.php?action=delete+26147
http://master.php.net/manage/user-notes.php?action=reject+26147