title: php static variable initialization using the $this keyword
body: <p>I'm having a method inside a class, in which I want to initialize a static variable.</p>
  
  <p>1/ when I initialize the variable, then affect it to some other value using the <code>$this</code> keyword, it works. E.g.:</p>
  
  <pre><code>class Test {
     // ...
     function test($input_variable)
     {
        static $my_static_variable = null;
        if (!isset($my_static_variable))
          $my_static_variable = $this-&gt;someFunction($input_variable);
        // ... some further processing 
     }
  }
  </code></pre>
  
  <p>2/ However, when I try to directly initialize / construct the variable with the <code>$this</code> keyword, there is a syntax error : <code>unexpected '$this' (T_VARIABLE)</code>:</p>
  
  <pre><code>class Test {
         // ...
         function test($input_variable)
         {
            static $my_static_variable = $this-&gt;someFunction($input_variable); // *** syntax error, unexpected '$this' (T_VARIABLE)
            // ... some further processing 
         }
  }
  </code></pre>
  
  <p>Is 1/ a good way to initialize a static variable?
  Why is 2/ not allowed, as it is supposed to do the exact same thing than in 1/?</p>
  
  <p>I'm using PHP 5.5.21 (cli) (built: Jul 22 2016 08:31:09).</p>
  
  <p>Thanks</p>