3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title></title> </head> <body> <script type="text/javascript"> var content = '<!DOCTYPE html><html><head></head><body></body></html>' </script> <div id="test">test</div> </body> </html> HTML; $dom = new DOMDocument('1.0', 'UTF-8'); $dom->validateOnParse = true; $dom->loadHTML($html); $xpath = new \DOMXPath($dom); var_dump($xpath->query("descendant-or-self::*[@id = 'test']", $dom));
Output for git.master, git.master_jit, rfc.property-hooks
Warning: DOMDocument::loadHTML(): Unexpected end tag : head in Entity, line: 9 in /in/NPK9P on line 22 Warning: DOMDocument::loadHTML(): Unexpected end tag : script in Entity, line: 10 in /in/NPK9P on line 22 Warning: DOMDocument::loadHTML(): Unexpected end tag : body in Entity, line: 12 in /in/NPK9P on line 22 object(DOMNodeList)#4 (1) { ["length"]=> int(1) }

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:
60.38 ms | 401 KiB | 8 Q