/e, eval, preg_replace_callback().
.
$sString = preg_replace("#\{\{(*.?)\}\}#e", 'echoText("$2")', $sString);
$this , 5.3+, , , :
$sString = preg_replace_callback("#\{\{(*.?)\}\}#", array($this, 'echoText'), $sString);
$this->echoText() , , .
:
$sString = preg_replace_callback("#\{\{(*.?)\}\}#", function ($matches) {
return $this->echoText($matches[1]);
}, $sString);