I want to insert new node to specific node but I have no idea how to do it
number.xml
<numbers>
<number>1</number>
<number>2</number>
<number>3</number>
<number>4</number>
<number>5</number>
</numbers>
number.php
<?php
$xml = new DOMDocument();
$xml->formatOutput=true;
$xml -> load('number.xml');
$xml_subnumber = $xml->createElement("subNumber");
$xml_subnumber_text = $xml->createTextNode("3.3");
$xml_subnumber->appendChild($xml_subnumber_text);
//something here (I have no idea.)
$xml->save("number.xml") or die("Error");
?>
and I want the xml file seem like this...
<numbers>
<number>1</number>
<number>2</number>
<number>3
<subNumber>3.3</subNumber>
</number>
<number>4</number>
<number>5</number>
</numbers>