3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<EOF <table> <tr> <td>something</td> <td>...</td> <td>...</td> </tr> <tr> <td></td> <td>...</td> <td>...</td> </tr> <tr> <td></td> <td>...</td> <td>...</td> </tr> <tr> <td>anything</td> <td>...</td> <td>...</td> </tr> <tr> <td></td> <td>also find</td> <td>...</td> </tr> <tr> <td></td> <td>this too</td> <td>...</td> </tr> <tr> <td>other</td> <td>...</td> <td>...</td> </tr> <tr> <td></td> <td>...</td> <td>...</td> </tr> </table> EOF; $doc = new DOMDocument(); $doc->loadHTML($html); $xpath = new DomXpath($doc); $res = $xpath->query('//td[contains(text(), "anything")]/..[count(2)]'); foreach($res as $tr){ var_dump($doc->saveXML($tr)); }
Output for git.master, git.master_jit
Warning: DOMXPath::query(): Invalid expression in /in/aaoUv on line 54 Warning: foreach() argument must be of type array|object, bool given in /in/aaoUv on line 56
Output for rfc.property-hooks
Warning: DOMXPath::query(): Invalid expression in /in/aaoUv on line 54 Warning: foreach() argument must be of type array|object, false given in /in/aaoUv on line 56

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
80.05 ms | 401 KiB | 8 Q