- ucfirst: documentation ( source)
<?php
$html = 'HTML String <h3>whatever</h3>';
$dom = new DOMDocument;
$dom->loadHTML($html);
$xpath = new DOMXPath($dom);
foreach ($xpath->query('//h3') as $h3) {
$h3->firstChild->nodeValue = ucfirst($h3->firstChild->nodeValue);
}
echo $dom->saveHTML();