Case 1
$file="<table border="4" summary="Hi"></table><table border="7" summary="Hi33443"></table>";
print : I found 2 tables and all of them have summary attribute.
Case 2
$file="<table border="4"></table><table border="7" summary="Hi33443"></table>";
print : I found 2 tables and 1 of them has summary attribute
-----------------------------------------------------
Cases for the other question
Case 1:
$file="<table border="4"><tr><th><abbr title="et cetera">etc.</abbr></th></tr></table><table border="7" summary="Hi33443"></table>";
print : Every th element I found had abbr attribute
Case 2:
$file="<table border="4"><tr><th><abbr title="et cetera">etc.</abbr></th></tr></table><table border="7" summary="Hi33443"><tr><th>etc.</th></tr><tr><th><abbr title="yes">yeap.</abbr></th></tr></table>";
print : I found th element with no abbr attibute