Jump to content

eregi_replace() is deprecated problem


entropicsinkhole

Recommended Posts

Ever since I upgraded to php 5.3, a program I've been running for awhile now has "eregi_replace() is deprecated" errors that point at this specific line as the culprit:         

 

<textarea name="messageText" rows="5" cols="75" wrap="off"><?php echo eregi_replace('<br[[:space:]]*/?[[:space:]]*>', "\n", $messageText); ?></textarea>

 

What can I replace this with? 

 

 

Link to comment
https://forums.phpfreaks.com/topic/180901-eregi_replace-is-deprecated-problem/
Share on other sites

Ugh, I probably should have mentioned I'm not a programmer and most of this is Greek to me :-/  I'm guessing that using preg_replace() instead of the eregi_replace() involves completely changing the syntax of the regex stuff in the brackets?  Or can I leave it the same?  The program in question is no longer maintained by the guy who made it, so I'm trying to see if I can salvage it :(  Fun times.   

So continuing with my issues, now that I've gone through the deprecated functions, etc.  This time with the split()  function.  I tried using the preg_split function in its place and tried to figure out the syntax myself.  It doesn't seem to be doing anything different, so I wanted to check my syntax

 

Original :

        echo 'parts = date.split("-");'._NL;

        echo 'parts = date.split(".");'._NL;

 

My Edit :

 

        echo 'parts=date.preg_split("/[-]/");'._NL;

        echo 'parts=date.preg_split("/\./");'._NL;

 

that's because your original is javascript which is a clientside language, whereas preg_split is php which is a serverside language.  The php equivalent of js's split is explode but clientside and serverside are two different environments...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.