Hello and welcome to our community! Is this your first visit?
Register
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
    Posts
    91
    Thanks
    2
    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:
    Original.....
        
    $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']); 


    Martin.

  • #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
    •