title: php - reset/clear an object?
body: <p>What I'm trying to do is use a temporary object to store values and then reset it back to empty without having to uset($tmpObject); ?</p>
  
  <p>Here is some example code:</p>
  
  <pre><code>class Object {
      function ResetObject(){
          // code to remove all variables in an object here?
      }
  }
  
  $tmpObject = new Object();
  
  foreach ($myArray as $arr){
      $tmpObject-&gt;val1 = "string1";
      $tmpObject-&gt;val2 = "string2";
      $tmpObject-&gt;val3 = "string3";
      $tmpObject-&gt;val4 = "string4";       
      $template-&gt;set('tmpObject',$tmpObject);
      $tmpObject-&gt;ResetObject();
  }
  </code></pre>
  
  <p>Anyone have any ideas?</p>