title: PHP extending class properties
body: <p>I have two classes in a PHP application, B extending A for example.
  Class A has a function which returns some of its other properties in the form of an array of SQL insert queries eg</p>
  
  <pre><code>Class A {
  $property_a;
  $property_b;
  $property_c;
  $property_d;
  
  function queries() {
  $queries = array();
  $queries[] = "INSERT INTO xxx VALUES " . $this-&gt;property_a . ", " . $this-&gt;property_b";
  $queries[] = "INSERT INTO yyy VALUES " . $this-&gt;property_b . ", " . $this-&gt;property_d";
  }
  }
  </code></pre>
  
  <p>I would like class B to have a similar (identical) function which does the same thing for class B's properties, whilst still maintaining the values from class A.  The idea being that each query will be passed through a final function all at the same time ie:</p>
  
  <pre><code>$mysqli-&gt;query("START TRANSACTION");
  foreach($queries as $query) {
  if(!$mysqli($query)) {
  $mysqli-&gt;rollback();
  }
  }
  </code></pre>
  
  <p>IF all OK $mysqli->commit();</p>
  
  <p>What would be the simplest way to achieve this?
  Any advice and ideas appreicated.
  Thanks!</p>