midwestdesignfirm Posted February 17, 2014 Share Posted February 17, 2014 Our sys admin upgraded to the most recent version of php and it broke many of our websites that we host. From the research that I have done, Function ereg_replace() is depreciated and no longer works in this version of PHP. originally the line of code was: $bio = ereg_replace("\n", "</p><p>", $row["bio"]); When i change it to: $bio = preg_replace("\n", "</p><p>", $row["bio"]); I get a new error: Warning: preg_replace(): Empty regular expression in/home/....../public_html/filename.php on line 70 what am i missing? Thank you in advance for any assistance. Link to comment https://forums.phpfreaks.com/topic/286263-php-upgraded-to-5425/ Share on other sites More sharing options...
Ch0cu3r Posted February 17, 2014 Share Posted February 17, 2014 yes with PHP5.4 ereg is deprecated. Instead you need to use preg_replace. When changing ereg_replace to preg_replace you need to add delimiters to your regex patterns. However with the code snippet you posted, it is replacing newlines with paragraph tags you could use str_replace instead $bio = str_replace("\n", "</p><p>", $row["bio"]); Link to comment https://forums.phpfreaks.com/topic/286263-php-upgraded-to-5425/#findComment-1469273 Share on other sites More sharing options...
midwestdesignfirm Posted February 17, 2014 Author Share Posted February 17, 2014 Perfect. Thank you for your assistance. Link to comment https://forums.phpfreaks.com/topic/286263-php-upgraded-to-5425/#findComment-1469277 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.