By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,747 Members | 1,380 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,747 IT Pros & Developers. It's quick & easy.

Deprecated: Function ereg() is deprecated

P: 6
here is the line that the error is on.

ereg('([a-z]{1,2})(-([a-z0-9]+))?(;q=([0-9\.]+))?',$lang,$found);
May 7 '10 #1
Share this Question
Share on Google+
3 Replies


P: 8
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.
May 7 '10 #2

P: 6
can you help me convert it?
May 7 '10 #3

P: 2
@jamietrent
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.
May 7 '10 #4

Post your reply

Sign in to post your reply or Sign up for a free account.