<?php
$tagname = "tr";
$doc = file_get_contents("test.html");
$pattern = "/<$tagname>(.*?)<\/$tagname>/";
preg_match_all($pattern, $doc, $matches);
foreach ($matches as $match) {
echo ++$xx; //counts up every match
echo " -- ";
echo $match;
echo "\n\r";
}
?>
This puts the text in between into $match and prints it on the screen but only grabs the first occurrence and prints it 2 times on the screen it has about 20+ time the appears.
How can I make it put them all on the screen each on a new line?