title: Remove all children from a XML Node PHP DOM
body: <p>I want to remove all children from a XML Node using PHP DOM, is there any difference between:</p>
  
  <p>A)</p>
  
  <pre><code>while ($parentNode-&gt;hasChildNodes()){
     $parentNode-&gt;removeChild($parentNode-&gt;childNodes-&gt;item(0));
   }
  </code></pre>
  
  <p>AND</p>
  
  <p>B)</p>
  
  <pre><code>$node-&gt;nodeValue = "";
  </code></pre>
  
  <p>I prefer the second one, seems like I am getting the same result but I'm not sure.</p>
  
  <p>Thanks,
  Carlos</p>