I needed an assistant
about replace for simple variables:
$html = '<{$headtype} class="{$class}">{$text}</{$headtype}>';
$array['headtype'] = 'h1';
$array['class'] = 'classname';
$array['text'] = 'the title';
// result
<h1 class="classname">the title</h1>
Knowing that the array is variable in keys and values