0

i have this code

$read = preg_replace(array('/LANG\[([0-9]*?)\]/e','/URL\[([0-9]*?)\]/e'),array('get_words(\\1)','url(\\1)'),$read);

how to fix it using preg_replace_callback

  • You probably need `preg_replace_callback_array`, example #1 here looks like the one you need: https://www.php.net/manual/en/function.preg-replace-callback-array.php – Matt Nov 11 '20 at 11:06

1 Answers1

0

The error message is telling you to remove the e modifier.

The e modifier is now removed/deprecated - https://www.php.net/manual/en/reference.pcre.pattern.modifiers.php

You can simply change the /e to /i to read this;

$read = preg_replace(array('/LANG\[([0-9]*?)\]/i','/URL\[([0-9]*?)\]/i'),array('get_words(\\1)','url(\\1)'),$read);

or remove the e completely to read this;

$read = preg_replace(array('/LANG\[([0-9]*?)\]/','/URL\[([0-9]*?)\]/'),array('get_words(\\1)','url(\\1)'),$read);
mw509
  • 1,957
  • 1
  • 19
  • 25