title: Access constant in class
body: <p>I try to access a constant in a class:</p>
  
  <p><em>file1.php</em></p>
  
  <pre><code>[...]    
  define('SUBDOMAIN','name');
  require_once 'file2.php';
  [...]
  </code></pre>
  
  <p><em>file2.php</em></p>
  
  <pre><code>[...]
  class Gdl_Ute extends Response_Model {    
  public $table = SUBDOMAIN.'zi_utp';
  
  public function statuses()
  {
  [...]
  </code></pre>
  
  <p>I've used some variants like:</p>
  
  <pre><code>public function __construct()
  {
  self::$table = SUBDOMAIN.'zi_utp';
  }
  </code></pre>
  
  <p>But there is always an error like:</p>
  
  <pre><code>PHP Parse error:  syntax error, unexpected '.', expecting ',' or ';'
  </code></pre>
  
  <p>or</p>
  
  <pre><code>syntax error, unexpected T_VARIABLE
  </code></pre>
  
  <p>Thanks very much for any hints! I've also read other similar questions on stackoverflow, but none has answered this problem correctly :/</p>
  
  <p><strong>UPDATE</strong>
  Now I've test the following solutions:</p>
  
  <p><em>file2.php</em></p>
  
  <pre><code>public $table;
  public function __construct()
  {
  self::$table = SUBDOMAIN.'zi_utp';
  }
  </code></pre>
  
  <p>OR</p>
  
  <p><em>file1.php</em></p>
  
  <pre><code>define('SUBDOMAIN',$subdomain);
  const SUBDOMAIN = $subdomain;
  </code></pre>
  
  <p>RESULT</p>
  
  <pre><code>Access to undeclared static property OR
  syntax error, unexpected T_VARIABLE
  </code></pre>