note 52133 added to language.constants

From: Date: Thu, 21 Apr 2005 21:09:05 +0000
Subject: note 52133 added to language.constants
Groups: php.notes 
Request: Send a blank email to php-notes+get-88373@lists.php.net to get a copy of this message
PHP Modules also define constants. Make sure to avoid constant name collisions. There are two ways to do this that I can think of. First: in your code make sure that the constant name is not already used. ex. <?php if (! defined("CONSTANT_NAME")) { Define("CONSTANT_NAME","Some Value"); } ?> This can get messy when you start thinking about collision handling, and the implications of this. Second: Use some off prepend to all your constant names without exception ex. <?php Define("SITE_CONSTANT_NAME","Some Value"); ?> Perhaps the developers or documentation maintainers could recommend a good prepend and ask module writers to avoid that prepend in modules. ---- Manual Page -- http://www.php.net/manual/en/language.constants.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+52133 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+52133&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+52133&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+52133&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+52133&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+52133&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+52133&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#88373) next »