title: replacing a child node value PHP-XML-DOM
body: <p>please help me in understanding the problem with replacing the child node</p>
  
  <pre><code>$dom = new DOMDocument();
  $dom-&gt;load('cheat.xml');
  $team1sabbr = $dom-&gt;getElementsByTagName('team1sabbr');
  $textNode = $dom-&gt;createTextNode('value-1');
  $textNode = $dom-&gt;importNode($textNode, true);
  $team1sabbr-&gt;replaceChild($textNode, $oldNode);
  $dom-&gt;save('cheat.xml');
  </code></pre>
  
  <p>its throwing an error like</p>
  
  <pre><code>Fatal error: Call to undefined method DOMNodeList::replaceChild()
  </code></pre>
  
  <p><code>cheat.xml</code> looks like</p>
  
  <pre><code> &lt;?xml version="1.0"?&gt;
  &lt;matches&gt;
  
              &lt;match id="2204"&gt;
  
      &lt;Game&gt;&lt;/Game&gt; 
  
          &lt;team1sabbr&gt;&lt;/team1sabbr&gt; 
  
          &lt;team2sabbr&gt;&lt;/team2sabbr&gt;
  </code></pre>