Interpreting simple PHP code
<p>To illustrate the concept of Destructor that a database is updated if values changes before the object is destroyed following code block is given in the book :</p>

<pre><code>&lt;?php
  class use {
  private $_properties;
  private $_changedProperties //Keeps a list of the properties that were altered
  private $_hDB;

  //_construct and __get omitted for brevity

  function __set($propertyName, $value) {
     if(!array_key_exists($propertyName, $this-&gt;_properties))
     throw new Exception('Invalid property value!');

   if(method_exists($this, 'set'. $propertyName)) {
   return call_user_func(
                       array($this, 'set', $propertyName), $value);
    }
    else {
    //If the value of the property really has changed
    //and it's not already in the changedProperties array,
    //add it.

    if($this-&gt;_properties[$propertyName] !=$value &amp;&amp; !in_array($propertyName,        $this-&gt;_changedProperties)) {
      $this-&gt;_changedProperties[] = $propertyName;
     }
</code></pre>

<p>Rest of the code was unnecessary code and has been omitted. Please explain the code from the point:</p>

<pre><code>        if(method_exists($this, 'set'. $propertyName)) {
   return call_user_func(
                       array($this, 'set', $propertyName), $value);
    }
    else {
    //If the value of the property really has changed
    //and it's not already in the changedProperties array,
    //add it.

    if($this-&gt;_properties[$propertyName] !=$value &amp;&amp; !in_array($propertyName, $this-&gt;_changedProperties)) {
      $this-&gt;_changedProperties[] = $propertyName;
     }
</code></pre>

<p>Why am i asking this is that, I want to verify my interpretation/understanding of the code.</p>
