0

It seems to be simple, but I have problem.

ereg_replace("\n","\\n",$row)

into preg_replace.

Anyone could give me a hand?

Yuri Stuken
  • 12,820
  • 1
  • 26
  • 23
Jeffz
  • 2,075
  • 5
  • 36
  • 51
  • Also explained in the manual: http://www.php.net/manual/en/function.ereg-replace.php#98602 – mario Jun 13 '11 at 03:51

1 Answers1

4

The only thing you need to change (except function name) is to add delimiters to the pattern (slashes in this case):

preg_replace("/\n/", "\\n", $row);

However, in this particular case you do not need to use regexes (which are slow enough), simple str_replace would be fine:

str_replace("\n", "\\n", $row);
Yuri Stuken
  • 12,820
  • 1
  • 26
  • 23