PHP ereg_replace deprecated

I have a script that throws me errors because I am running PHP 5.3.1
What do I need to use in the example?

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

Deprecated: The ereg_replace () function is deprecated at.

+4
source share
2 answers

Use preg_replace , just add separators .

 $row[$j] = preg_replace("#\n#", "\\n", $row[$j]); 
+19
source
+1
source

All Articles