title: PHP how to use parent-class object variables in extended classes?
body: <p>I'm sorry this appears to be a beginners question.
  How do I access a parent-class object variables in its extended classes?</p>
  
  <pre><code>class FOO {
    public $foo;
    function __construct() {
      $this-&gt;foo = 'string';
    }
  }
  
  class Parent {
    public $x;
    function __construct() {
      $this-&gt;x = new FOO();
      var_dump($x); // this works
    }
  }
  
  class Child extends Parent {
    public $y;
    function __construct() {
      var_dump($this-&gt;x); // appears to be NULL all the time
    }
  }
  </code></pre>
  
  <p>how do I pass the value or reference of $x correctly?</p>