Function eregi () is deprecated

Source: Internet
Author: User
Tags posix

After PHP is upgraded to php5.3, some programs often find the function eregi () is deprecated error message.Why?
This is because the eregi () function is no longer supported in php5.3 and is replaced by the preg_match () function.
The solution is to replace the eregi () function with the preg_match () function.
If (eregi ('^ test', $ file ))
Can be replaced
If (preg_match ('/^ test/I', $ file ))
 
-----
The RegEx after PHP 5.3.0 is expected to use the PCRE specification. POSIX RegEx is not recommended (Unified RegEx to avoid too many specifications ?).
Therefore, the following is a list of functions (PCRE) not recommended for use (POSIX) and recommended for replacement: 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
* Split of RegEx is required, which can be replaced by preg_split ().
* No RegEx is required. You only need to quickly split a fixed string and replace it with explode (). (The speed is much faster than that of RegEx)

Function eregi () is deprecated

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.