note 39469 deleted from function.define by didou
| From: | didou@php.net | Date: | Thu, 29 Jan 2004 17:31:14 +0000 |
| Subject: | note 39469 deleted from function.define by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-64386@lists.php.net to get a copy of this message | ||
Note Submitter: cheatah@tweakers.net
----
<?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.