title: PHP Class Variable Access
body: <p>Seems like a simple enough question, so my apologies for asking. As a precursor I'm not necessarily 'new', but rather not so well-versed in PHP.</p>
  
  <p>I have a class, declared as follows:</p>
  
  <pre><code>class User
  {
      public $id = "";
  
      public function User()
      {
          $this-&gt;$id = isset($_COOKIE['userid']) ? $_COOKIE['userid'] : 0;
      }
  }
  </code></pre>
  
  <p>Which seems simple enough, however - upon construction, I get the following set of errors:</p>
  
  <pre><code>Notice: Undefined variable: id in D:\xampp\htdocs\sitecore\include\classes.php on line 13
  
  Fatal error: Cannot access empty property in D:\xampp\htdocs\sitecore\include\classes.php on line 13
  </code></pre>
  
  <p>Sorry for asking something so simple. The line in question starts with "$this->$id".</p>