title: is this a valid class variable ? $this->$variablename
body: <p>I am referencing to a variable like this</p>
  
  <pre><code>$this-&gt;variablename
  </code></pre>
  
  <p>but I have seen accessing variable like this:</p>
  
  <pre><code>$this-&gt;$variablename
  </code></pre>
  
  <p>for example in a google script</p>
  
  <pre><code>public function __get($key)
  {
      $keyTypeName = $this-&gt;keyType($key);
      $keyDataType = $this-&gt;dataType($key);
      if (isset($this-&gt;$keyTypeName) &amp;&amp; !isset($this-&gt;processed[$key])) {
        if (isset($this-&gt;modelData[$key])) {
          $val = $this-&gt;modelData[$key];
        } else if (isset($this-&gt;$keyDataType) &amp;&amp;
            ($this-&gt;$keyDataType == 'array' || $this-&gt;$keyDataType == 'map')) {
          $val = array();
        } else {
          $val = null;
        }
     }
  }
  </code></pre>
  
  <p>in this example it is <code>$this-&gt;$keyTypeName</code>, is this an error or valid code?. In php 7 it is giving error. </p>