Some errors after php is upgraded to 5.3 +, such as ereg (); ereg_replace (); function error _ php instance

Source: Internet
Author: User
Tags ereg
This article mainly introduces some errors that occur after php is upgraded to 5.3 +, such as ereg (), ereg_replace (), and relevant information about function error reporting, if you need it, you can refer to it and run it in the php5.3 environment.

Deprecated: Function ereg () is deprecated in... And Deprecated: Function ereg_replace () is deprecated in... error messages for these types.

The reason is that php5.3 and later versions do not support the ereg () function, but use the preg_match () function. They do not support the ereg_replace () function, but use the preg_replace () function.

  Solution: Change unsupported functions to supported functions.

For example

 

The Code is as follows:


If (eregi ('^ ('value', $ value)


Changed:

 

The Code is as follows:


If (preg_match ('/value/', $ value)


For example:

  

The Code is as follows:


$ String = ereg_replace ('value', '', trim ($ string ));

Changed:

The Code is as follows:


$ String = preg_replace ('{value}', '', trim ($ string ));

Solution Deprecated: Assigning the return value of new by reference is deprecated in error

Because php is 5.3, "=" can be directly used in php5.3 ", in the previous tests, the php environment below 5.3 used the "= &" symbol.

The "= &" symbol cannot be used in programs after version 5.3. If the Deprecated: Assigning the return value of new by reference is deprecated in error occurs on your website, do not worry. first locate the file with the error, find whether the program uses the "= &" symbol, and find that the "= &" symbol is used. After removing the "&" symbol, the program runs normally.

Problem: Deprecated: Function set_magic_quotes_runtime () is deprecated in

The cause is that this feature (set_magic_quotes_runtime () has been disabled after PHP5.3.

This feature has been completely removed from PHP6.

You can comment out or delete the wrong row, or add the @ symbol before set_magic_quotes_runtime ().

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.