I want this code to replace in the "platform" tag with something like "newData"
$xml = new DOMDocument();
$xml->load('myhappyfarmsave.xml');
$xpath = new DOMXPath($xml);
$elements = $xpath->query('/myhappyfarmsave/platform');
$domElement = $elements->item(0);
var_dump($domElement->textContent);
$domElement->textContent = "newData";
$xml->save('myhappyfarmsavenew.xml');
I don't know what's wrong with my code. thanks for your help
<?xml version="1.0" encoding="UTF-8"?>
<myhappyfarmsave version="3">
<platform>Bazaar</platform>
<timestamp>1356876534</timestamp>
<lastlogtime>1356823542</lastlogtime>
</myhappyfarmsave>