title: creating child object and passing parent as parameter on construct in PHP
body: <p>When u create an child object and you want to pass a parent object as parameter on construct you can do like in the code below:</p>
  
  <pre><code>class parent {
    protected $x;
    protected $y;
    public function __construct($x, $y) {
      $this-&gt;x = $x;
      $this-&gt;y = $y;
    }
  }
  
  class child extends parent {
   protected $z;
   public function __construct($parent, $z) {
     parent::__construct($parent-&gt;x, $parent-&gt;y);
     $this-&gt;z = $z;
   }
  }
  </code></pre>
  
  <p>but in this case i am just multiplying parent.</p>
  
  <p>Is there any way to not copy parents data and append proper object? and code to look something like this:</p>
  
  <pre><code>class child extends parent {
   protected $z;
   public function __construct($parent, $z) {
     parent = $parent;
     $this-&gt;z = $z;
   }
  }
  </code></pre>