<div class="center"></div>
<div style="text-align: center;"></div>
$dom = new DOMDocument();
$element = $dom->createElement("div");
$element->setAttribute("id", "id1");
$dom->appendChild($element);
$tmp = $dom->createDocumentFragment();
$tmp->appendXML('<h1>Hello <b>World!</b></h1>');
$xpath = new DOMXPath($dom);
$xpath->query("//*[@id='id1']")->item(0)->appendChild($tmp);
echo $dom->saveHTML();
ideone.com/KnSQ8l 0 23 * * * java -jar /var/www/prg/programma.jar
$dom = new DOMDocument;
$dom->loadXML('<div>123 <br /> 456</div>');
$xpath = new DOMXPath($dom);
foreach ($xpath->query('//div/text()') as $textNode) {
echo trim($textNode->nodeValue), PHP_EOL;
}
ideone.com/FYkZwX