3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $html = <<<HTML <a name="file_type_definition"></a>file_type_definition ::= <font color=#a08000><strong>FILE<strong>other stuff</strong></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(new DOMText(sprintf("'%s'", $strong->textContent)),$strong); } var_dump($dom->textContent);
based on I661L
Output for 5.5.0 - 7.3.0beta1
string(59) "file_type_definition ::= 'FILEother stuff' 'OF' type_mark"