PHP ereg_replace deprecated [duplicate]

走远了吗. 提交于 2019-11-26 22:04:56

问题


I have a script that throws me errors because I run PHP 5.3.1
What Do I have to use in the example?

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

Deprecated: Function ereg_replace() is deprecated in..


回答1:


Use preg_replace instead, just add delimiters.

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



回答2:


Use the preg_replace function instead.



来源:https://stackoverflow.com/questions/4226107/php-ereg-replace-deprecated

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!