title: Why don't PHP attributes allow functions?
body: <p>I'm pretty new to PHP, but I've been programming in similar languages for years.  I was flummoxed by the following:</p>
  
  <pre><code>class Foo {
      public $path = array(
          realpath(".")
      );
  }
  </code></pre>
  
  <p>It produced a syntax error: <code>Parse error: syntax error, unexpected '(', expecting ')' in test.php on line 5</code> which is the <code>realpath</code> call.</p>
  
  <p>But this works fine:</p>
  
  <pre><code>$path = array(
      realpath(".")
  );
  </code></pre>
  
  <p>After banging my head against this for a while, I was told you can't call functions in an attribute default; you have to do it in <code>__construct</code>.  My question is: why?!  Is this a "feature" or sloppy implementation?  What's the rationale?</p>