Home  >  Article  >  Backend Development  >  Some errors occurred after php was upgraded to 5.3, such as ereg(); ereg_replace(); function error, eregeg_replace_PHP tutorial

Some errors occurred after php was upgraded to 5.3, such as ereg(); ereg_replace(); function error, eregeg_replace_PHP tutorial

WBOY
WBOYOriginal
2016-07-12 09:03:51838browse

Some errors occurred after php was upgraded to 5.3, such as ereg(); ereg_replace(); function error, eregeg_replace

often occurs when running in php5.3 environment

Deprecated: Function ereg() is deprecated in... and Deprecated: Function ereg_replace() is deprecated in... These types of error messages.
The reason is: PHP5.3 or above does not support the ereg() function, but uses the preg_match() function; it does not support the ereg_replace() function, but uses the preg_replace() function.
Solution: Just change the unsupported function to a supported function.
 
 For example
 if(eregi('^('value', $value)
 Changed to:
 if(preg_match('/value/', $value)
  🎜> Another example:
$string = ereg_replace(' value', ' ', trim($string));
Change to:
$string = preg_replace('{ value}', ' ', trim($string));
 
Solution to Deprecated: Assigning the return value of new by reference is deprecated in error

Because our current php is 5.3, you can use "=" directly in php5.3. In the past, because the local testing was in PHP environments below 5.3, the "=&" symbol was used.

After version 5.3, the "=&" symbol is no longer allowed in programs. If the error Deprecated: Assigning the return value of new by reference is deprecated in appears on your website, don’t worry. First locate the file with the error and check whether “=&” is used in the program. You will find that “=” is used. &" symbol, the program runs normally after removing the '&' symbol.

Problem: Deprecated: Function set_magic_quotes_runtime() is deprecated in The reason for this prompt is that this feature (set_magic_quotes_runtime()) has been turned off after PHP5.3.
And this feature has been completely removed in PHP6.
You can comment or delete the wrong line, or add the @ symbol in front of set_magic_quotes_runtime()

http://www.bkjia.com/PHPjc/1077537.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1077537.htmlTechArticleSome errors occurred after php was upgraded to 5.3, such as ereg(); ereg_replace(); function reported an error, eregeg_replace is in When running in the php5.3 environment, Deprecated: Function ereg() is de...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn