title: Accessing a parents variable from subclass php and parent keyword?
body: <p>I have a parent class and a subclass, the parent class has a constructer that sets a <code>var</code> and I would like to use that <code>var</code> in the subclass, I have it working but am getting confused by the keyword <code>parent</code>?</p>
  
  <p>Example</p>
  
  <pre><code> class Sub extends Parent {
       public function foo() {
           echo $this -&gt; myVar;
       }
   }
  
   class Parent {
       var $myVar;
       public function __construct() {
            $this -&gt; myVar = 'a';
       }
   }
  </code></pre>
  
  <p>This worked and I get the value of <code>myVar</code>, but am I supposed to be using the keyword <code>parent</code> and when I do I get an error, example,</p>
  
  <pre><code> class Sub extends Parent {
       public function foo() {
           echo parent -&gt; myVar;
       }
   }
  
   class Parent {
       var $myVar;
       public function __construct() {
            $this -&gt; myVar = 'a';
       }
   }
  </code></pre>