Deprecated language features are those that have been retained temporarily for backward compatibility, but which will eventually be removed from the language. In effect, deprecation announces a grace period to allow the smooth transition from the old features to the new ones. In that period, no use of the deprecated features should be added to the code, and all existing uses should be gradually removed.
The following functions were deprecated in PHP 5:
| Deprecated | Use 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() (note that this is deprecated in PHP 5.5) |
eregi() |
preg_match() with 'i' modifier |
eregi_replace() |
preg_replace() with 'i' modifier |
set_magic_quotes_runtime() and its alias, magic_quotes_runtime() |
|
session_register() |
$_SESSION superglobal |
session_unregister() |
$_SESSION superglobal |
session_is_registered() |
$_SESSION superglobal |
set_socket_blocking() |
stream_set_blocking() |
split() |
preg_split() |
spliti() |
preg_split() with 'i' modifier |
sql_regcase() |
|
mysql_db_query() |
mysql_select_db() and mysql_query() |
mysql_escape_string() |
mysql_real_escape_string() |
| Passing locale category names as strings | Use the LC_* family of constants |
The following functions were deprecated in PHP 7:
| Deprecated | Use Instead |
|---|---|
__autoload() |
spl_autoload_register() |
create_function() |
anonymous function |
parse_str() without second argument |
parse_str() with second argument |
gmp_random() |
gmp_random_bits() or gmp_random_range() |
each() |
foreach |
assert() with string argument |