The task is this. I need to split the resulting table by tr and inside tr by td. At the moment I have the following:
$doc = phpQuery::newDocumentHTML($page); $table = pq($doc)->find('table > tr > td'); $exp = explode('<td>', pq($table)); With print_r ($ exp), the following is output:
Array ( [0] => [1] => jake</td> [2] => two</td> [3] => three</td> [4] => 4</td> [5] => jakes</td> [6] => 6</td> [7] => seven</td> [8] => 8</td> </tr>) And I would like the result to be as follows:
Array( [0] =>array( [0] => jake [1] => two [2] => three [3] => 4 ) [1] => array( [0] => jakes [1] => 6 [2] => seven [3] => 8 ) That is, an array of tr strings is needed, where the elements of this array are td. To further put this table here: https://github.com/viossat/arraytotexttable
And it is not clear yet why he doesn’t add anything to the first element.
I hope I am right in the right direction at all =)