Skip to content
Advertisement

How to pass the parameters properly for a callback function for preg_replace_callback using a preexisting function?

I am getting this error: Parse error: syntax error, unexpected ” (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING)……… eval()’d code on line 2 Since removing e from the regex expression ~<IF (.?)(?<!-)>(.?)~se as shown in the line below because it became deprecated.

JavaScript

I understood I need to use preg_replace_callback() and rewrite using an anonymous function however I am running into troubles rewriting it as $this->get_templates_callback() needs to be called and executed as well.

JavaScript

How should I properly go about properly passing parameters into this function?

Advertisement

Answer

You can use use statement to pass additional parameters.

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement