While working with some legacy code, I have came across 2 preg_replace
functions with now deprecated /e
parameter. PHP suggest to replace it with preg_replace_callback
.
These are the functions:
First:
$content = preg_replace("/(\{([a-zA-Z0-9_]+)\})/e", null, $content);
From what I understand,
/e
is safe to remove from this function?Second:
$text = preg_replace( "/<(h[2])>(.+)<\/(h[2])>/Uie", "'<\\1 id=\"'.createIdByText('\\2').'\">'.stripslashes('\\2').'</\\1>'", $text );
Can anyone help me fixing these or converting to preg_replace_callback so they don't throw a deprecation warning?