-1

Anybody knows how to change this function with preg_replace and the /e modifier. I'm getting a weird error when debug because the /e modifier.Seems that was depreciated.

$globCont = preg_replace("/{(\w*)}/e", '$this->TemplateGlobals["$1"]', $content);
u_mulder
  • 54,101
  • 5
  • 48
  • 64
emk
  • 3
  • 2

1 Answers1

2

Use an anonymous function:

$globCont = preg_replace_callback("/{(\w*)}/", 
                                  function($m) {
                                      return $this->TemplateGlobals[$m[1]];
                                  }, $content);
AbraCadaver
  • 78,200
  • 7
  • 66
  • 87