Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Mar 2012
    Thanked 0 Times in 0 Posts

    is this change correct 'eregi_replace' to 'preg_replace'.

    Hi All,

    I have a process code which uses 'eregi_replace' and want to change to the 'preg_replace'.

    I have made a change but need conformation that what I did is actually correct.

    This is just an update of an existing code and I copied over the "[\r|\n]*", as it existed but added the I to become "/[\r|\n]*/i" in the event I used actual characters at some point.

    PHP Code:
    $destination_email eregi_replace("[\r|\n]*"""$_POST['destination_email']);
    $email eregi_replace("[\r|\n]*"""$_POST['Customer_Email']);
    $subject eregi_replace("[\r|\n]*"""$_POST['subject']);
    $response_email eregi_replace("[\r|\n]*"""$_POST['response_email']);
    $response_name eregi_replace("[\r|\n]*"""$_POST['response_name']);

    Changed to.....
    $destination_email preg_replace ("/[\r|\n]*/i"""$_POST['destination_email']);
    $email preg_replace ("/[\r|\n]*/i"""$_POST['Customer_Email']);
    $subject preg_replace ("/[\r|\n]*/i"""$_POST['subject']);
    $response_email preg_replace ("/[\r|\n]*/i"""$_POST['response_email']);
    $response_name preg_replace ("/[\r|\n]*/i"""$_POST['response_name']); 


  2. #2


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts