3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = 'HTML String <h3>whatever</h3>'; $dom = new DOMDocument; $dom->loadHTML($html, LIBXML_HTML_NODEFDTD); //Don't add a default doctype. $xpath = new DOMXPath($dom); foreach ($xpath->query('//h3') as $h3) { $h3->nodeValue = ucfirst($h3->nodeValue); } echo $dom->saveHTML();

preferences:
106.11 ms | 402 KiB | 5 Q