I have this HTML:
$html =
<div class="content">
<table>..</table>
<table>..</table>
<table>..</table>
<table>..</table>
<table>..</table>
<table>..</table>
<table>..</table>
<table>..</table>
</div>
and php:
$doc = new DOMDocument();
$doc->loadHTML($html);
$xpath = new DOMXpath($doc);
$body = $xpath->query('/table');
This echo's out all tables:
echo $doc->saveXml($body->item(0));
My question is is it possible to save EACH table (with html tags) into array, so it would look like this:
Array ( [0] => < table> < /table> [1] => < table> < /table> [2] => < table> < /table> . . . [n] => < table> < /table> )
Is there a short way to echo out lets say 3rd table, something like this:
echo $doc->saveXml($body->item(3));