title: "PHP Fatal error: Constant expression contains invalid operations", when initializing a static inline?
body: <p>I am wondering why is it that my static variable initialization does not work with the following declaration:</p>
  
  <pre><code>function validate()
  {
      static $timezones = DateTimeZone::listIdentifiers(); // Error here
  
      ...
  }
  </code></pre>
  
  <p>The line with <code>static ...</code> generates the error:</p>
  
  <blockquote>
    <p>PHP Fatal error:  Constant expression contains invalid operations</p>
  </blockquote>
  
  <p>If I do the following, though, it works as expected:</p>
  
  <pre><code>function validate()
  {
      static $timezones = null;
      if(!isset($timezones))
      {
          $timezones = DateTimeZone::listIdentifiers();
      }
      ...
  }
  </code></pre>
  
  <p>So I have a way around the problem, but I am wondering why is it that the first method fails?</p>