0

I found one PHP script for get a database backup, there use this expression to do something, that script show call to undefined function ereg_replace() this error, if i remove this line script is working fine... how to replace this function $row[$j] = ereg_replace("\n","\\n",$row[$j]); to that script working finely,

Can anyone assist me..

1 Answers1

1

ereg_replace deprecated and remove from newer versions of php (7 and up).

You will have to update your code to use preg_replace

$row[$j] = preg_replace("#\n#","\\n",$row[$j]);

One of the differences between ereg_replace() and preg_replace() is that the pattern must be enclosed by delimiters: delimiter + pattern + delimiter, in this case we are using # so we don't have to escape / that is the usual that is used.

Valid Delimiters:

 /, #, ~, +, %, @, ! , <, > 

Reference from php.net

hope it helps.

Vidal
  • 2,605
  • 2
  • 16
  • 32