How to join node value which have same node name with PHP? My output:
<SHOP>
<SHOPITEM>
<title>BERMUDY FRANKLIN</title>
<text>6skladem 3 kusů</text>
<text>7skladem 8 kusů</text>
<text>22skladem 33 kusů</text>
<unit>0</unit>
</SHOPITEM>
<SHOPITEM>
<title>FRANKLIN 14221</title>
<text>6skladem 3 kusů</text>
<text>7skladem 8 kusů</text>
<unit>0</unit>
</SHOPITEM>
</SHOP>
And i wish this:
<SHOP>
<SHOPITEM>
<title>BERMUDY FRANKLIN</title>
<text>6skladem 3 kusů<br>7skladem 8 kusů<br>22skladem 33 kusů</text>
<unit>0</unit>
</SHOPITEM>
<SHOPITEM>
<title>FRANKLIN 14221</title>
<text>6skladem 3 kusů<br>7skladem 8 kusů</text>
<unit>0</unit>
</SHOPITEM>
</SHOP>
How improve this code which do first block of code? I am totaly lost..thx:
foreach ($items as $item)
{
$pieces = $item->getElementsByTagName("STOREPIECES");
$sizename = $item->getElementsByTagName("SIZENAME");
$sizenamevalue = $sizename->item(0)->nodeValue;
$piecesvalue = $pieces->item(0)->nodeValue;
$query = $xpath->query('DESCRIPTION', $item);
$text = $query->nodeValue .= $sizenamevalue . 'stock ' . $piecesvalue . ' pc';
$node = $dom->createElement("text", "$text");
$item->parentNode->parentNode->appendChild($node);
}