note 39469 added to function.define
| From: | cheatah at tweakers dot net | Date: | Thu, 29 Jan 2004 17:27:15 +0000 |
| Subject: | note 39469 added to function.define | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-64385@lists.php.net to get a copy of this message | ||
<?php
function define_once ( $constant, $value ) {
if ( !defined ( $constant ) ) {
define ( $constant, $value );
}
}
?>
Should be part of the standard PHP functions. I use it all the time for configuration of functions
and classes in code libraries. If the settings aren't defined before including the library
files, all constants in those libraries will be assigned with default values.
----
Manual Page -- http://www.php.net/manual/en/function.define.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+39469
Delete -- http://master.php.net/manage/user-notes.php?action=delete+39469&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+39469&report=yes
Search -- http://master.php.net/manage/user-notes.php