Deprecated: Function ereg() is deprecated

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jamietrent
    New Member
    • May 2010
    • 6

    Deprecated: Function ereg() is deprecated

    here is the line that the error is on.

    ereg('([a-z]{1,2})(-([a-z0-9]+))?(;q=([0-9\.]+))?',$lang,$fo und);
  • AngryJoe
    New Member
    • May 2010
    • 8

    #2
    As of PHP 5.3 ereg is deprecated, meaning it is no longer supported. You should switch to the preg class of functions.

    Click here to go to the PHP site and check it out.

    Comment

    • jamietrent
      New Member
      • May 2010
      • 6

      #3
      can you help me convert it?

      Comment

      • dz3100
        New Member
        • May 2010
        • 2

        #4
        Originally posted by jamietrent
        here is the line that the error is on.

        ereg('([a-z]{1,2})(-([a-z0-9]+))?(;q=([0-9\.]+))?',$lang,$fo und);
        I think this is the translation:
        preg_match_all( '/([a-z]{1,2})(-([a-z0-9]+))?(;q=([0-9\.]+))?/', $lang, $found);

        Maybe take it for a spin? I had to do this once to drupal to get it to run on my server, and this was the solution, I think.

        The functions are similar, except on the pattern, add a "/" char at the beginning and the end.

        Comment

        Working...