note 44598 added to function.define
| From: | JustinFrench at osu1 dot php dot net | Date: | Tue, 10 Aug 2004 20:05:13 +0000 |
| Subject: | note 44598 added to function.define | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-79774@lists.php.net to get a copy of this message | ||
Constants defined within a function (or class I assume) will only be defined within the
scope/namespace of the function in which you defined it.
<?
function test() {
define('PET_NAME','fluffy');
}
define('PET_TYPE','cat');
echo PET_NAME.'is a '.PET_TYPE;
?>
Will echo "PET_NAME is a cat", not "fluffy is a cat".
----
Manual Page -- http://www.php.net/manual/en/function.define.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+44598
Delete -- http://master.php.net/manage/user-notes.php?action=delete+44598&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+44598&report=yes
Search -- http://master.php.net/manage/user-notes.php