PHP upgrade to 5.3+ after a number of errors, such as ereg (); Ereg_replace (); Function Error _php Instance

Source: Internet
Author: User
Tags deprecated ereg

Running in a php5.3 environment often occurs

deprecated:function ereg () is deprecated in .... and Deprecated:function ereg_replace () are deprecated in .... These types of error prompts.

The reason for this is that the php5.3 version does not support the Ereg () function, but instead uses the Preg_match () function, the ereg_replace () function is not supported, and the Preg_replace () function is used.

  Workaround: Modify an unsupported function to a supported function.

For example

 

Copy Code code as follows:

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

To

 

Copy Code code as follows:

if (Preg_match ('/value/', $value)

Again for example:

  

Copy Code code as follows:

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

To

Copy Code code as follows:

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

Resolve deprecated:assigning The return value of the new by reference is deprecated in error

Because we now PHP is 5.3 of the reason, in the php5.3 can be used directly "=", and previously because the local test is 5.3 below the PHP environment with the "=&" symbol.

The "=&" symbol is not allowed in a program after version 5.3. If your site appears deprecated:assigning the return value of the ' return ' of new by reference be deprecated in error, don't worry, navigate to the wrong file and find out if it's used in the program "=& ", found that using the" =& "symbol, remove the ' & ' symbol after the program runs normally.

Question: Deprecated:function set_magic_quotes_runtime () is deprecated in

This is caused by the fact that this attribute (Set_magic_quotes_runtime ()) has been closed after PHP5.3.

This attribute has been completely removed from the PHP6.

You can annotate or delete the wrong line, or precede the set_magic_quotes_runtime () with the @ sign

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.