Hi. I was wondering what is the lifetime of a constant once defined as:

define('X')

Also another question - suppose this is my index.php:

<?php
/ Short and sweet /
define('WP_USE_THEMES', true);

require('./wp-blog-header.php');
?>

Is there gonna be any memory leak in this case, because the variable is redefined on each visit? Maybe I should check if it's defined first?

    A define()'ed constant exists until the script terminates and is only available within that script, though its scope is global within that script. (So separate invocations of the same script will not collide with regard to constant definitions.)

    You cannot re-define() an existing constant in the same script (including any include files), as any attempt to do so will result in a fatal error.

      Write a Reply...