Some errors that occur after PHP upgrade to 5.3+, such as Ereg (); Ereg_replace (); function error, eregereg_replace_php tutorial

Source: Internet
Author: User
Tags deprecated ereg

Some errors that occur after PHP upgrade to 5.3+, such as Ereg (); Ereg_replace (); function Error, Eregereg_replace


Running in a php5.3 environment often occurs

Deprecated:function Ereg () is Deprecated in ... and Deprecated:function ereg_replace () is a deprecated in ... These types of error alerts.
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 the unsupported function to a supported function.
  
For example
if (eregi (' ^ (' value '), $value)
Switch
if (Preg_match ('/value/', $value)
  
Again for example:
$string = ereg_replace (' value ', ' ', Trim ($string));
Switch
$string = Preg_replace (' {value} ', ', trim ($string));
  
Fix deprecated:assigning The return value of new by reference was deprecated in error

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

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

Problem: Deprecated:function set_magic_quotes_runtime () is Deprecated in
The reason for this hint is that this attribute (Set_magic_quotes_runtime ()) has been turned off after PHP5.3.
This feature has been completely removed from the PHP6.
You can comment or delete the line that went wrong, or add the @ sign before set_magic_quotes_runtime ()

http://www.bkjia.com/PHPjc/1077537.html www.bkjia.com true http://www.bkjia.com/PHPjc/1077537.html techarticle Some errors that occur after PHP upgrade to 5.3+, such as Ereg (), ereg_replace (), function error, eregereg_replace running in php5.3 environment, often deprecated:function ereg () Is de ...

  • 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.