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
    CBG
    CBG is offline
    New Coder
    Join Date
    Feb 2010
    Location
    UK
    Posts
    91
    Thanks
    26
    Thanked 0 Times in 0 Posts

    ereg Deprecated on php 5.3.6 looking for ereg replacement

    Hi,

    I am running on a host that has PHP 5.3.6 and am getting a deprecated for ereg.

    Here is the line of code I am getting the error on:

    elseif ( !ereg("^([_[:alnum:]\,\'\ \.\-])+$", $string)) {

    Should I change it to preg_match ?

    Or should it be something else, if so what should I check ereg to?
    Last edited by CBG; 08-29-2011 at 11:07 AM.
    Regards,
    CBG

  • #2
    Senior Coder Dormilich's Avatar
    Join Date
    Jan 2010
    Location
    Behind the Wall
    Posts
    3,474
    Thanks
    13
    Thanked 361 Times in 357 Posts
    Quote Originally Posted by CBG View Post
    Should I change it to preg_match ?
    yes. the preg_* functions have replaced the ereg functions
    The computer is always right. The computer is always right. The computer is always right. Take it from someone who has programmed for over ten years: not once has the computational mechanism of the machine malfunctioned.
    André Behrens, NY Times Software Developer


  •  

    Posting Permissions

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