edson tomas
edson tomas

Reputation: 31

How should I deal with the message "Deprecated: Function eregi() is deprecated..."?

I'm seeing the following message on my site, what should I do?

Deprecated: Function eregi() is deprecated in D:\wamp\www\cidoc.gov.mz\modules\mod_swmenupro\functions.php on line 2542

Upvotes: 3

Views: 893

Answers (2)

Nanne
Nanne

Reputation: 64399

You're using the function "eregi()" that was deprecated in PHP 5.3.0

You can

a. downgrade your php version (not recommended) or

b. use stristr(). The manual has a comment that says this you can use to replace the code in your files:

because eregi is not recommended after php 5, you can replaced it with stristr if just for simple search.

For editors with regular expression function:

eregi\(([^,]*),([^)]*)\)
stristr(\2,\1)

I have not tried this.

Upvotes: 1

Shakti Singh
Shakti Singh

Reputation: 86386

Here is a list of deprecated functions and the replacement functions

Function replacements POSIX PCRE 
ereg_replace() => preg_replace() 
ereg() => preg_match() 
eregi_replace() => preg_replace() 
eregi() => preg_match() 
split() => preg_split() 
spliti() => preg_split() 
sql_regcase() => No equivalent 

user preg_match() instead of eregi()

Upvotes: 3

Related Questions