After php was upgraded to php5.3, I often found that some programs would display the error message "Function eregi() is deprecated" during use. What is the reason?
This is because the eregi() function is no longer supported in php5.3 and the preg_match() function is used instead.
The solution is: replace the eregi() function with the preg_match() function.
if(eregi('^test',$file))
can be replaced with
if(preg_match('/^test/i',$file))
————-
For regex after PHP 5.3.0, I hope to use PCRE specifications. POSIX Regex is not recommended (unify Regex to avoid too many specifications?).
So the following is a list of functions (POSIX) that are deprecated, and functions (PCRE) that are recommended to be replaced. For details, see: PHP:
Differences from POSIX regex
* 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
* For split that requires regex, you can use preg_split() instead.
* No need for regex, as long as you want to quickly split fixed words String, you can use explode() instead. (The speed will be much faster than requiring regex)