Deprecated PHP functions and replaced by that

Source: Internet
Author: User
Tags deprecated ereg explode

Original link http://blog.csdn.net/a11085013/article/details/8937848Some of the deprecated functions are listed below:
Call_user_method ()(usingCall_user_func ()Alternative
Call_user_method_array ()(usingCall_user_func_array ()Alternative
Define_syslog_variables ()
DL ()
Ereg ()(usingPreg_match ()Alternative
Ereg_replace ()(usingPreg_replace ()Alternative
Eregi ()(usingPreg_match ()Replace with ' i ' modifier)
Eregi_replace ()(usingPreg_replace ()Replace with ' i ' modifier)
Set_magic_quotes_runtime ()and its alias function.Magic_quotes_runtime ()
[Color=olive]session_register ()(using$_sessionSuper all variable substitution)
Session_unregister ()(using$_session Super All variablesAlternative
Session_is_registered ()(using$_session Super All variablesAlternative
Set_socket_blocking ()(usingStream_set_blocking ()Alternative
Split ()(usingPreg_split ()Alternative
Spliti ()(usingPreg_split ()Replace with ' i ' modifier)
Sql_regcase ()
Mysql_db_query ()(usingmysql_select_db ()Andmysql_query ()Alternative
Mysql_escape_string ()(usingMysql_real_escape_string ()Alternative
Obsolete to pass the locale name as a string. UseLc_*Series constant substitution.
Mktime ()OfIs_dstParameters. Use the new time zone handler function override.

The main function migration involved is as follows:
Delete function Define_syslog_variables Reference Delete reference to function Define_syslog_variables $LOG _err, $LOG _user, etc. with constant log_user, Log_user, ... Alternative
Ereg, Eregifunction withPreg_matchFunctions that override these functions declare int ereg (String$pattern, String $string [, Array & $regs]) int eregi (string $pattern, String $str ing [, array & $regs]) Intpreg_match (string $pattern, String $subject [, Array & $matches [, int $flags [, int $offset]]) Although the first parameter of the three is a string representing a regular expression, Preg_match uses the PCRE (Perl-compatible regular expression syntax):The ends of a regular expression are bounded by a symbol, such as "/pattern/" or "#pattern #", the eregi is a slightly case-sensitive match, converted to Preg_match, the first argument,Use the parameters of the pcre to slightly case, such as: "/pattern/i" or "#pattern #i", the third parameter of the two returns a different structure of the matching data. The third parameter of Ereg, after the call is finished, returns an array of strings, each of which is the complete matching string and each sub-matching string. Preg_match returns a two-dimensional array, which is equivalent to a string in an array of ereg strings, where Preg_match is an array, preserving the matching values and matching positions, respectively. If multiple matches are to be made, PHP provides the Preg_match_all function, and the return value of its third parameter is a three-dimensional array.
Ereg_replace, Eregi_replacefunction withPreg_replacefunction or Str_replace function to replace the previous ereg with Preg_match similar, the first parameter to be converted, the head and tail to add a symbol, such as: "/pattern/" or "#pattern #", ... eregi_replace to Preg Replace the _replace, adding a regular expression parameter after the first argument. such as: "/pattern/i" or "#pattern #i", ... If the first parameter of Ereg_replace is not a regular expression, you can replace it with str_replace directly.
Splitifunction withThe explode or preg_split function replaces the split-splitting string, and if you don't need a regular expression, it's best to use explode instead of the fastest. For using a regular expression to slice a string, use the Preg_split function instead. The substitution process is similar to ereg/ereg_replace, just a fuss in the first regular expression argument, with the split regular expression preceded and followed by a PCRE separator symbol.

Deprecated PHP functions and replaced by that

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.