I'm having some difficulty confirming a match with the results returned from preg_match_all. Here's the code:
$str = "<table class=\"ProfileChart\">
<tr>
<th class=\"TableHead\" colspan=\"21\">2003 Sales</th>
</tr></table>";
preg_match_all("/<table[^>]*?>((.|\r\n|\r|\n)*?)<\/table>/",$str,$tableMatches);
if (is_array($tableMatches[1])) {
echo "You have a match!\n";
} else {
echo "We're not matching here!\n";
}
It seems that the is_array($tableMatches[1]) is not doing the trick, as it always comes up as an array. Perhaps I'm confused about the way this should work.
Is there a better way to do this?
Thanks,
John