title: Importing Parent function data in child php oop
body: <p>I am trying to learn simple method of php oop by calling parent function data in child.
  However somewhere I am making mistake.</p>
  
  <pre><code>class name{
      var $firstname;
      var $lastname;
      var $name;
      public function name($firstname, $lastname){
          $this-&gt;firstname=$firstname;
          $this-&gt;lastname=$lastname;
          $this-&gt;name=$this-&gt;firstname." ".$this-&gt;lastname;
          return $this-&gt;name;
      }
  }
  class sentence extends name{
      var $name;
      var $letter;
      function sentence(){
          $this-&gt;letter="My name is ";
          echo $this-&gt;letter.$this-&gt;name;
      }
  }
  $name=new name(ABC, Xyz);
  $letter=new sentence();
  </code></pre>
  
  <p>I have created one calls to get name input and another child class to write the sentence. However not able to call the name in child.</p>