Jump to content

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...

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.