- preg_replace: documentation ( source)
<?php
function compileEchoes($value){
$value = preg_replace ('/\{\{\{\s*(.+?)\s*\}\}\}/s', '<?php echo $1; ?>', $value);
return preg_replace ('/\{\{\s*(.+?)\s*\}\}/s', "<?php echo htmlentities($1, ENT_QUOTES, 'UTF-8', false); ?>", $value);
}
$that = compileEchoes('{{{<strong>Is this bold?</strong>}}}');
echo $that;
?>