title: Variable constants in PHP
body: <p>Is it possible to change the value of a constant in PHP? We want sensible defaults for the configuration files for our project.</p>
  
  <p>Currently we are doing:</p>
  
  <p>config.php:</p>
  
  <pre><code>define('WEB_ROOT', '/home/user/public_html');
  </code></pre>
  
  <p>config.default.php:</p>
  
  <pre><code>defined('WEB_ROOT') || define('WEB_ROOT', '/home/user/public_html');
  </code></pre>
  
  <p>The problem is that in certain cases, you may want to access certain configuration defaults from inside 'config.php'. For example:</p>
  
  <p>config.php</p>
  
  <pre><code>define('USER_FILE_ROOT', WEB_ROOT.'/files');
  </code></pre>
  
  <p>The scheme with constants for configuration has been used for 5 years, and rewriting the framework is not an option.</p>