PHP DOM解析HTML表

I am trying to parse a HTML table in a page.

However, it is not the only TABLE in the page, and I am only interested in parsing the 2nd <table> instnace in the HTML page.

How do I specify to parse only the 2nd TABLE instance in the HTML page?

//the table by its tag name  
$tables = $dom->getElementsByTagName('table');   

Use DOMNodelist->item() (item() expects as argument the index, it's zero-based so 1 will return the 2nd table )

 $table = $dom->getElementsByTagName('table')->item(1);