Preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead

I’m looking for help to convert preg_replace to preg_replace_callback for a specific script.
I know I have to delete the e modifier, but what would the code look like? Please help!

 $source_content = preg_replace($search.'e', "'"
                                   . $this->_quote_replace($this->left_delimiter) . 'php'
                                   . "' . str_repeat(\"\n\", substr_count('\\0', \"\n\")) .'"
                                   . $this->_quote_replace($this->right_delimiter)
                                   . "'"
                                   , $source_content);

$source_content = preg_replace_callback($search, function($matches) {
    return "'"
        . $this->_quote_replace($this->left_delimiter) . 'php'
        . "' . str_repeat(\"\n\", substr_count('\\0', \"\n\")) .'"
        . $this->_quote_replace($this->right_delimiter)
        . "'";
}, $source_content);
Sponsor our Newsletter | Privacy Policy | Terms of Service