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
https://forums.phpfreaks.com/topic/231131-ereg-eregi-php5/
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
https://forums.phpfreaks.com/topic/231131-ereg-eregi-php5/#findComment-1189685
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
https://forums.phpfreaks.com/topic/231131-ereg-eregi-php5/#findComment-1189720
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.