PHP5.3废弃函数 顶替记
PHP5.3废弃函数 替代记
?call_user_method()(使用 call_user_func() 替代)
????call_user_method_array() (使用 call_user_func_array() 替代)
????define_syslog_variables()
????dl()
????ereg() (使用 preg_match() 替代)
????ereg_replace() (使用 preg_replace() 替代)
????eregi() (使用 preg_match() 配合 ‘i’ 修正符替代)
????eregi_replace() (使用 preg_replace() 配合 ‘i’ 修正符替代)
????set_magic_quotes_runtime() 以及它的别名函数??magic_quotes_runtime()
????session_register() (使用 $_SESSION 超全部变量替代)
????session_unregister() (使用 $_SESSION 超全部变量替代)
????session_is_registered() (使用 $_SESSION 超全部变量替代)
????set_socket_blocking() (使用 stream_set_blocking() 替代)
????split() (使用 preg_split() 替代)
????spliti() (使用 preg_split() 配合 ‘i’ 修正符替代)
????sql_regcase()
????mysql_db_query() (使用 mysql_select_db() 和??mysql_query() 替代)
????mysql_escape_string() (使用 mysql_real_escape_string() 替代)
????废弃以字符串传递区域设置名称. 使用 LC_* 系列常量替代.
????mktime() 的 is_dst 参数. 使用新的时区处理函数替代.
涉及到的主要的函数迁移如下:
删除函数 define_syslog_variables 引用删除对函数 define_syslog_variables 的引用将变量 $LOG_ERR, $LOG_USER 等用常量 LOG_USER, LOG_USER, … 替代
ereg, eregi 函数用 preg_match 函数替代这几个函数的函数声明int ereg ( string$pattern , string $string [, array &$regs ] ) int eregi ( string $pattern , string $string [, array &$regs ] ) intpreg_match ( string $pattern , string $subject [, array &$matches [, int $flags [, int $offset ]]] )虽然三者的第一个参数都是字符串,表示一个正则表达式,但是 preg_match 用的是 PCRE(Perl 兼容的正则表达式语法):正则表达式的两端用一个符号做边界,如 “/pattern/” 或者 “#pattern#”,eregi 是乎略大小写的匹配,转换为 preg_match,第一个参数,用PCRE的参数来乎略大小写,如:”/pattern/i” 或者 “#pattern#i”,两者的第三个参数返回的匹配的数据结构不同。ereg 的第三个参数在调用结束后,返回的是一个字符串数组,分别为完整匹配字串和各个子匹配字串。preg_match 返回的是二维数组,相当于 ereg 的字串数组中的字串在 preg_match 是一个数组,分别保存匹配值以及匹配位置。如果要进行多次匹配,PHP 提供了 preg_match_all 函数,其第三个参数的返回值则是一个三维数组.
ereg_replace, eregi_replace 函数用 preg_replace 函数或者 str_replace 函数来替代和前面的 ereg 替换为 preg_match 类似,第一个参数要进行转换,头尾增加一个符号,如:”/pattern/” 或者 “#pattern#”, …eregi_replace 到 preg_replace 的替换,在第一个参数的后面增加正则表达式参数。如:”/pattern/i” 或者 “#pattern#i”, …如果 ereg_replace 的第一个参数不是正则表达式,可以用 str_replace 直接来替换。
spliti 函数用 explode 或则 preg_split 函数替代split 切分字符串,如果无须用到正则表达式,使用 explode 替换是最好不过,速度最快.对于使用正则表达式切分字串,则使用 preg_split 函数替代。替代过程和 ereg/ereg_replace 类似,只是在第一个正则表达式参数中做文章,将 split 的正则表达式前后加上一个 PCRE 的分隔符号。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Convert basic data types to strings using Java's String.valueOf() function In Java development, when we need to convert basic data types to strings, a common method is to use the valueOf() function of the String class. This function can accept parameters of basic data types and return the corresponding string representation. In this article, we will explore how to use the String.valueOf() function for basic data type conversions and provide some code examples to

Method of converting char array to string: It can be achieved by assignment. Use {char a[]=" abc d\0efg ";string s=a;} syntax to let the char array directly assign a value to string, and execute the code to complete the conversion.

Replace characters (strings) in a string using Java's String.replace() function In Java, strings are immutable objects, which means that once a string object is created, its value cannot be modified. However, you may encounter situations where you need to replace certain characters or strings in a string. At this time, we can use the replace() method in Java's String class to implement string replacement. The replace() method of String class has two types:

Hello everyone, today I will share with you the basic knowledge of Java: String. Needless to say the importance of the String class, it can be said to be the most used class in our back-end development, so it is necessary to talk about it.

The split method in String uses the split() method of String to split the String according to the incoming characters or strings and return the split array. 1. General usage When using general characters, such as @ or, as separators: Stringaddress="Shanghai@Shanghai City@Minhang District@Wuzhong Road";String[]splitAddr=address.split("@");System .out.println(splitAddr[0]+splitAddr[1]+splitAddr[2]+splitAddr[3

Use Java's String.length() function to get the length of a string. In Java programming, string is a very common data type. We often need to get the length of a string, that is, the number of characters in the string. In Java, we can use the length() function of the String class to get the length of a string. Here is a simple example code: publicclassStringLengthExample{publ

1. Understanding String1. String in JDK First, let’s take a look at the source code of the String class in the JDK. It implements many interfaces. You can see that the String class is modified by final. This means that the String class cannot be inherited and there is no subclass of String. class, so that all people using JDK use the same String class. If String is allowed to be inherited, everyone can extend String. Everyone uses different versions of String, and two different people Using the same method shows different results, which makes it impossible to develop the code. Inheritance and method overriding not only bring flexibility, but also cause many subclasses to behave differently.

MySQL is a commonly used relational database management system that provides a variety of functions to process and operate data. Among them, the REPLACE function is used to replace the specified part of the string. In this article, we will introduce how to use the REPLACE function for string replacement in MySQL and demonstrate its usage through code examples. First, let’s take a look at the syntax of the REPLACE function: REPLACE(str,search_str,replace_str).
