title: Does reassigning an object variable destroy the object (e.g. mysqli)?
body: <p>I have a global variable for a mysqli connection set like so:</p>
  <pre><code>$mysqli = new mysqli($dbserver, $dbuser, $dbpass, $dbname);
  </code></pre>
  <p>The php manual says:</p>
  <blockquote>
  <p>Open non-persistent MySQL connections and result sets are
  automatically closed when their objects are destroyed.</p>
  </blockquote>
  <p>If I reassign the variable to a new connection (using the same code) is this the same as destroying the object? Or do I need to destroy the variable explicitly?</p>
  <p>I know I can use <code>$mysqli-&gt;close();</code> but prefer to avoid possible error conditions.</p>
  <p>If I do need to destroy the object, is there a simple test to make sure the connection is a valid one first (e.g. using <code>isset</code>)?</p>