Please help with Deprecated: Function eregi() is deprecated

Hello, could you help me with the following error:
The code that needs to be fixed is below the error.

Thanks in advance!
Aldi

Deprecated: Function eregi() is deprecated in language.php on line 87

[php]if (eregi(’^(’ . $value . ‘)(;q=[0-9]\.[0-9])?$’, $this->browser_languages[$i]) && isset($this->catalog_languages[$key])) {
$this->language = $this->catalog_languages[$key];
break 2;[/php]

use preg_match or preg_replace depending on what you’re trying to do.

Thank you for replying richei.

I don’t know how to use the function.

Could you move the parameters from my old erigi() function and replace them in the new preg_match function?

I’ll appreciate your help! Thanks!

[php]if (eregi(’^(’ . $value . ‘)(;q=[0-9]\.[0-9])?$’, $this->browser_languages[$i]) && isset($this->catalog_languages[$key])) { $this->language = $this->catalog_languages[$key];[/php]

I inserted / /i pair but I’m still getting the same error message: Deprecated: Function eregi() is deprecated in language.php on line 87

Belew is the modification I did. Can someone help?

[php]if (preg_match(’/^(’ . $value . ‘)(;q=[0-9]\.[0-9])?$/i’, $this->browser_languages[$i]) && isset($this->catalog_languages[$key])) {
$this->language = $this->catalog_languages[$key];[/php]

If you’re still getting the same error, then you’re using that function somewhere else in the script. If the script is working though, just add @ in front of it to supress the error messages.

(@eregi(’^(’ . $value . ‘)(;q=[0-9]\.[0-9])?$’, $

Sponsor our Newsletter | Privacy Policy | Terms of Service