3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $html = <<<EOF <table> <tr> <td>5CG </td> <td>aass </td> <td>sxs </td> <td>sx </td> <td>EK </td> <td> </td> <td>72 </td> </tr> <td> </td> <td>samplxs </td> <td>xs </td> <td> </td> <td>xss </td> <td>fkxsx aus</td> <td>s </td> </tr> <td> </td> <td>5AH. </td> <td>ds </td> <td>d </td> <td>sdf </td> <td>sdfsdf aus</td> <td> </td> </tr> <tr> <td>6CG </td> <td>3. </td> <td>sfd </td> <td> </td> <td>scs </td> <td>das aus</td> <td>a </td> </tr> <tr> <td>7DG </td> <td>6. </td> <td>s </td> <td>s </td> <td>sD </td> <td>sdsa.</td> <td> </td> </tr> <td> </td> <td>samplxs </td> <td>xs </td> <td> </td> <td>xss </td> <td>fkxsx aus</td> <td>s </td> </tr> <tr> <td>7DG, 7CG, 7CR </td> <td>6. </td> <td>NsdR </td> <td>s </td> <td>SP </td> <td>fasdlt aus</td> <td>s </td> </tr> <td> </td> <td>samplxs </td> <td>xs </td> <td> </td> <td>xss </td> <td>fkxsx aus</td> <td>s </td> </tr> <tr> <td> 9BR </td> <td>6. </td> <td>FEI </td> <td>sa </td> <td>DE </td> <td>fasdad aus</td> <td> </td> </tr> <tr> <td>9AR, 9BR, 9CR</td> <td>62. </td> <td>BEH </td> <td> </td> <td>sd </td> <td>fasda aus</td> <td> </td> </tr> <tr> <td> </td> <td>6. </td> <td>MLR </td> <td> </td> <td>FdR </td> <td>fsdfaus</td> <td> </td> </tr> <tr> <td>E10C </td> <td>6. </td> <td>sdf </td> <td>d </td> <td>d </td> <td>fsdfs aus</td> <td> </td> </tr> </table> EOF; $docH = new DOMDocument(); $docH->loadHTML($html); $xpath = new DomXpath($docH); $trs = $xpath->query('//td[contains(text(), "BR9")]/..'); foreach( $trs as $tr){ var_dump($tr); }
Output for 5.2.3 - 5.6.28, 7.0.0 - 7.1.0
Warning: DOMDocument::loadHTML(): Unexpected end tag : tr in Entity, line: 19 in /in/J7STC on line 115 Warning: DOMDocument::loadHTML(): Unexpected end tag : tr in Entity, line: 27 in /in/J7STC on line 115 Warning: DOMDocument::loadHTML(): Unexpected end tag : tr in Entity, line: 53 in /in/J7STC on line 115 Warning: DOMDocument::loadHTML(): Unexpected end tag : tr in Entity, line: 70 in /in/J7STC on line 115
Output for hhvm-3.10.0 - 3.12.0
Warning: Unexpected end tag : tr in Entity, line: 19 Warning: Unexpected end tag : tr in Entity, line: 27 Warning: Unexpected end tag : tr in Entity, line: 53 Warning: Unexpected end tag : tr in Entity, line: 70
Output for 5.1.3 - 5.2.2
<br /> <b>Warning</b>: DOMDocument::loadHTML() [<a href='function.DOMDocument-loadHTML'>function.DOMDocument-loadHTML</a>]: Unexpected end tag : tr in Entity, line: 19 in <b>/in/J7STC</b> on line <b>115</b><br /> <br /> <b>Warning</b>: DOMDocument::loadHTML() [<a href='function.DOMDocument-loadHTML'>function.DOMDocument-loadHTML</a>]: Unexpected end tag : tr in Entity, line: 27 in <b>/in/J7STC</b> on line <b>115</b><br /> <br /> <b>Warning</b>: DOMDocument::loadHTML() [<a href='function.DOMDocument-loadHTML'>function.DOMDocument-loadHTML</a>]: Unexpected end tag : tr in Entity, line: 53 in <b>/in/J7STC</b> on line <b>115</b><br /> <br /> <b>Warning</b>: DOMDocument::loadHTML() [<a href='function.DOMDocument-loadHTML'>function.DOMDocument-loadHTML</a>]: Unexpected end tag : tr in Entity, line: 70 in <b>/in/J7STC</b> on line <b>115</b><br />
Output for 5.1.2
<br /> <b>Warning</b>: DOMDocument::loadHTML() [<a href='function.loadHTML'>function.loadHTML</a>]: Unexpected end tag : tr in Entity, line: 19 in <b>/in/J7STC</b> on line <b>116</b><br /> <br /> <b>Warning</b>: DOMDocument::loadHTML() [<a href='function.loadHTML'>function.loadHTML</a>]: Unexpected end tag : tr in Entity, line: 27 in <b>/in/J7STC</b> on line <b>116</b><br /> <br /> <b>Warning</b>: DOMDocument::loadHTML() [<a href='function.loadHTML'>function.loadHTML</a>]: Unexpected end tag : tr in Entity, line: 53 in <b>/in/J7STC</b> on line <b>116</b><br /> <br /> <b>Warning</b>: DOMDocument::loadHTML() [<a href='function.loadHTML'>function.loadHTML</a>]: Unexpected end tag : tr in Entity, line: 70 in <b>/in/J7STC</b> on line <b>116</b><br />
Output for 5.0.0 - 5.1.1
<br /> <b>Warning</b>: DOMDocument::loadHTML() [<a href='function.loadHTML'>function.loadHTML</a>]: Unexpected end tag : tr in Entity, line: 19 in <b>/in/J7STC</b> on line <b>115</b><br /> <br /> <b>Warning</b>: DOMDocument::loadHTML() [<a href='function.loadHTML'>function.loadHTML</a>]: Unexpected end tag : tr in Entity, line: 27 in <b>/in/J7STC</b> on line <b>115</b><br /> <br /> <b>Warning</b>: DOMDocument::loadHTML() [<a href='function.loadHTML'>function.loadHTML</a>]: Unexpected end tag : tr in Entity, line: 53 in <b>/in/J7STC</b> on line <b>115</b><br /> <br /> <b>Warning</b>: DOMDocument::loadHTML() [<a href='function.loadHTML'>function.loadHTML</a>]: Unexpected end tag : tr in Entity, line: 70 in <b>/in/J7STC</b> on line <b>115</b><br />
Output for 4.3.2 - 4.4.1, 4.4.3 - 4.4.9
<br /> <b>Fatal error</b>: Cannot instantiate non-existent class: domdocument in <b>/in/J7STC</b> on line <b>114</b><br />
Process exited with code 255.
Output for 4.4.2
<br /> <b>Fatal error</b>: Cannot instantiate non-existent class: domdocument in <b>/in/J7STC</b> on line <b>115</b><br />
Process exited with code 255.
Output for 4.3.0 - 4.3.1
<br /> <b>Fatal error</b>: Cannot instantiate non-existent class: domdocument in <b>/in/J7STC</b> on line <b>114</b><br />