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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Apr 2012
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Unhappy Problems with replacing depreciated function in my script

    I am having trouble understanding how to fix this error in my script as im not skilled in php very well any help is more than appreciated.

    Here is the listed errors (2) in total

    1) Deprecated: Function eregi() is deprecated in /home/socia125/public_html/profile.php on line 231

    here is line 231 of my code

    Code:
     if (eregi($Match, $agent)) {
    2)Deprecated: Function ereg_replace() is deprecated in /home/socia125/public_html/wi_class_files/autoMakeLinks.php on line 26

    here us line 26 of my code

    Code:
            $newString = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]","<a href=\"\\0\" target=\"_blank\">\\0</a>", $originalString);
    any help is appreciated

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Its a deprecation warning. In the future, ereg functions will disappear completely.
    You'll need to use preg instead as its PCRE not POSIX. I can't help you with the first one since there is no $Match available to modify, the but second one would be replaced with:
    PHP Code:
    $newString preg_replace('#[a-z]+://[^<>\s]+[a-z0-9]#i''<a href="$0" target="_blank">$0</a>'$originalString); 
    Although the pattern could be cleaned up to actually match only a valid url.

  • Users who have thanked Fou-Lu for this post:

    mister256 (04-23-2012)

  • #3
    New to the CF scene
    Join Date
    Apr 2012
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Fou-Lu View Post
    Its a deprecation warning. In the future, ereg functions will disappear completely.
    You'll need to use preg instead as its PCRE not POSIX. I can't help you with the first one since there is no $Match available to modify, the but second one would be replaced with:
    PHP Code:
    $newString preg_replace('#[a-z]+://[^<>\s]+[a-z0-9]#i''<a href="$0" target="_blank">$0</a>'$originalString); 
    Although the pattern could be cleaned up to actually match only a valid url.
    thanks so much friend i appreciate it


  •  

    Tags for this Thread

    Posting Permissions

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