public static function insertNewConfigLine($newNodeName, $attributesAndValuesArray){
$xml = simplexml_load_file("config.xml");
$newNode = $xml->addChild($newNodeName);
foreach ($attributesAndValuesArray as $attribute => $value)
$newNode->addAttribute($attribute, $value);
file_put_contents("config.xml", $xml->asXML());
$doc = new DOMDocument('1.0');
$doc->preserveWhiteSpace = false;
$doc->loadXML($xml->asXML());
$doc->formatOutput = true;
echo $doc->saveXML();
} What should i do to get proper indentation?


Sign In
Create Account


Back to top









