title: Can I set a PHP class property from an existing variable?
body: <p>I am trying to figure out how I want to handle settings in my PHP app.  I have pretty much decide that I would like to use a Confg class file so it will be autoloaded and flexible in the future.  Below is some stuff I was playing with.  </p>
  
  <p>I know you cannot set a variable to popluate a Constant so I then try to use a public static property.  </p>
  
  <p>Why can I not set <strong>public static $ip = $_SERVER['REMOTE_ADDR'];</strong> ??</p>
  
  <pre><code>&lt;?php
  // config.class.php
  class Config
  {
      const URL = 'http://www.foo.com';
      const DB_User = 'dbname';
  
      public static $test = 'test string';
      public static $ip = $_SERVER['REMOTE_ADDR'];
  }
  
  ///////////////////////////////////////////////////////
  //index.php
  
  // works
  echo Config::URL;
  
  // works
  echo Config::$test;
  
  // DOES NOT WORK
  echo Config::$ip;
  
  ?&gt;
  </code></pre>