#!/usr/bin/php Config as $id => $config) { if ( startsWith((string)$config->attributes()->Description,"Container ".(string)$config->attributes()->Type) ) { $config->attributes()->Description = ""; $changeFlag = true; } } if ( $changeFlag ) { copy($file,"$file.bak"); $dom = new DOMDocument('1.0'); $dom->preserveWhiteSpace = false; $dom->formatOutput = true; $dom->loadXML($xml->asXML()); file_put_contents($file,$dom->saveXML()); } } ?>