Home >Backend Development >PHP Tutorial >Sorting out obsolete/expired functions in PHP 5.3 and 5.5_PHP Tutorial

Sorting out obsolete/expired functions in PHP 5.3 and 5.5_PHP Tutorial

WBOY
WBOYOriginal
2016-07-13 10:23:35856browse

PHP 5.3 and 5.5 obsolete/expired functions

Anyone who works in PHP knows that starting from PHP 5.3, a new error level DEPRECATED has been added, which is about to be abandoned/expired. We’ve been through version after version.

The functions abandoned in php5.3 are:

The code is as follows

call_user_method() (use call_user_func() Substitute)
call_user_method_array() (use call_user_func_array() instead)
define_syslog_variables()
dl()
ereg() (use preg_match() instead)
ereg_replace() (use preg_replace() instead)
eregi() (use preg_match() with the 'i' modifier instead)
eregi_replace() (use preg_replace() with the 'i' modifier)
set_magic_quotes_runtime() and its alias function magic_quotes_runtime()
session_register() (use $_SESSION to replace all variables)
session_unregister() (use $_SESSION to replace all variables)
session_is_registered() (use $_SESSION to replace all variables)
set_socket_blocking() (use stream_set_blocking() instead)
split() (use preg_split() instead)
spliti() (use preg_split() with the 'i' modifier instead)
sql_regcase()
mysql_db_query() (use mysql_select_db() and mysql_query() instead)
mysql_escape_string() (use mysql_real_escape_string() instead)

 代码如下  

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() 替代)

mysql_close(); // 将不支持全部关闭, 需要改为:mysql_close($link);

mysql_close(); // will not Supports closing all, needs to be changed to: mysql_close($link);

Deprecated passing locale name as string. Use LC_* series constants instead.

The is_dst parameter of mktime(). Use the new time zone processing function instead.

PHP 5.4
 代码如下  

mcrypt_generic_end()
mysql_list_dbs()

The code is as follows

mcrypt_generic_end()
mysql_list_dbs()

PHP 5.5
 代码如下  
mcrypt_cbc()
mcrypt_cfb()
mcrypt_ecb()
mcrypt_ofb()

Among them, PHP 5.3 is the beginning of deprecating functions. Many commonly used regular eregs have replaced preg. Fortunately, I knew this before. All replaced, but the magic quotes. . It has actually been deprecated since PHP 5.3, and was removed in PHP 5.4. This is considered a big change in PHP 5.3.

PHP 5.4 has added many new features. You can search online for this and many new special writing methods have been added. Maybe old programmers can’t understand the new way of writing~~~

What to say about PHP 5.5? I just discovered it today~ It actually removed the MYSQL extension. It is recommended to use MYSQLI or PDO. . . After using 5.5, many programs will report errors, indicating that mysql_connect is about to expire~~~You will see the following error

 Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in E:testnew 6.php on line 6

The biggest improvement of PHP5 compared to 4 is the class part, and the bigger impact is the abandonment of these old habits. Although the version has been upgraded, after all, there are still a large number of 5.1.6-5.2.17 on the market. 5.3 began to abandon many features, causing many programs to not dare to directly use it. 5.5 directly killed a lot of open source haha~~~

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/834972.htmlTechArticlePHP 5.3 and 5.5 obsolete/expired functions I believe everyone who works in PHP knows that a function has been added since PHP5.3 The new error level DEPRECATED will be abandoned/expired soon. We’ve been through version after version. In...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn