3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = '<{$headtype} class="{$class}">{$text}</{$headtype}>'; $array['headtype'] = 'h1'; $array['class'] = 'classname'; $array['text'] = 'the title'; foreach ($array as $key => $value) { $html = str_replace('{$'.$key.'}', $value, $html); } echo $html;

preferences:
11.48 ms | 404 KiB | 5 Q