Tags
PHP
Asked 8 years ago
20 Oct 2016
Views 1600
chirag

chirag posted

Deprecated: Function eregi() is deprecated in php

i am working with my old website and i upgraded some hosting plan which shared hosting with PHP MYSQL
And i got this at from my site header . site is loaded full but get error like this



Deprecated: Function eregi() is deprecated in /home/mydomain/public_html/includes/classes/language.php on line 87

Deprecated: Function eregi() is deprecated in /home/mydomain/public_html/includes/classes/language.php on line 87

Deprecated: Function eregi() is deprecated in /home/mydomain/public_html/includes/classes/language.php on line 87

Deprecated: Function eregi() is deprecated in /home/mydomain/public_html/includes/classes/language.php on line 87

Deprecated: Function eregi() is deprecated in /home/mydomain/public_html/includes/classes/language.php on line 87

Deprecated: Function eregi() is deprecated in /home/mydomain/public_html/includes/classes/language.php on line 87

Deprecated: Function eregi() is deprecated in /home/mydomain/public_html/includes/classes/language.php on line 87

Deprecated: Function eregi() is deprecated in /home/mydomain/public_html/includes/classes/language.php on line 87

Deprecated: Function eregi() is deprecated in /home/mydomain/public_html/includes/classes/language.php on line 87

Warning: Cannot modify header information - headers already sent by (output started at /home/mydomain/public_html/includes/classes/language.php:87) in /home/mydomain/public_html/includes/functions/general.php on line 1234


so how to solve this error ?
Rasi

Rasi
answered Nov 30 '-1 00:00

use function exist to check is there eregi function or not ?
if no than place code to execute the function in same manner so you dont need to replace eregi at every place.

if (!function_exists('eregi')) {
function eregi(  $pattern ,  $string ,  &$regs  ){
//place code for preg_match
}
}
Phpworker

Phpworker
answered Nov 30 '-1 00:00

put @ before the function eregi() at given line so it will not display error .
its not good solution , i think its hide the error only but still error is there - debugger  
Oct 20 '16 07:27
Mitul Dabhi

Mitul Dabhi
answered Nov 30 '-1 00:00

You need to upgarde your php application . so start with by replacing the eregi function to preg_match

eregi function was DEPRECATED in PHP 5.3.0, and REMOVED in PHP 7.0.0.
use alternative of funciton eregi.

you can use preg_match() (with the i (PCRE_CASELESS) modifier) instead of eregi function



Post Answer