- print_r: documentation ( source)
- preg_match_all: documentation ( source)
- str_replace: documentation ( source)
<?php
$html = "<test1>Dies ist ein Test</test1>\n<test2>\nUsw. usf.\n</test2>";
echo $html;
preg_match_all("|<([^>]+)>(.*?)</[^>]+>|s", $html, $treffer, PREG_SET_ORDER);
echo "\nErgebnis:\n\n";
$fileContentArray = array();
foreach ($treffer as $wert) {
$fileContentArray[$wert[1]] = str_replace("\n", "", $wert[2]);
}
print_r($fileContentArray);