Jump to content

Ereg & Eregi PHP5


jamesjmann

Recommended Posts

I'm sure this issue has been addressed before, but as I can't find anything on google OR bing, I've resorted to asking it here:

 

Since, ereg and eregi are deprecated in PHP5, how do you test strings using regular expressions? Is there a new function for this?

 

EDIT: I also looked on php.net, but all it says is its deprecated in PHP5. I didn't see any links to the new function(s) that have replaced the former.

Link to comment
Share on other sites

Notes

 

    Note:

 

    As of PHP 5.3.0, the regex extension is deprecated in favor of the PCRE extension. Calling this function will issue an E_DEPRECATED notice. See the list of differences for help on converting to PCRE.

 

    Note:

 

    preg_match(), which uses a Perl-compatible regular expression syntax, is often a faster alternative to ereg().

Link to comment
Share on other sites

Notes

 

    Note:

 

    As of PHP 5.3.0, the regex extension is deprecated in favor of the PCRE extension. Calling this function will issue an E_DEPRECATED notice. See the list of differences for help on converting to PCRE.

 

    Note:

 

    preg_match(), which uses a Perl-compatible regular expression syntax, is often a faster alternative to ereg().

 

I know, and I AM using javascript, but I'm making sure that php catches the errors if javascript isn't enabled on the user's computer. Just to be safe.

 

And thanks for the quick reply. I'ma go look up PCRE, right now. Might need help converting my current ereg calls though.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.