3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<HTML <a name="file_type_definition"></a>file_type_definition ::= <font color=#a08000><strong>FILE</strong></font> <font color=#a08000><strong>OF</strong></font> <a href="#type_mark">type_mark</a> HTML; $dom = new DOMDocument(); $dom->loadHTML($html); $xpath = new DOMXPath($dom); foreach($xpath->query('//strong') as $strong) { $strong->parentNode->replaceChild(sprintf("'%s'", $strong->textContent),$strong); } var_dump($dom->textContent);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught TypeError: DOMNode::replaceChild(): Argument #1 ($node) must be of type DOMNode, string given in /in/sO3YP:13 Stack trace: #0 /in/sO3YP(13): DOMNode->replaceChild(''FILE'', Object(DOMElement)) #1 {main} thrown in /in/sO3YP on line 13
Process exited with code 255.

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:
32.11 ms | 406 KiB | 5 Q