Deprecated predefined variables in PHP should not be used because they may lead to compatibility issues and unpredictable behavior in future versions of PHP. Relying on deprecated variables can result in code that is difficult to maintain and may break when migrating to newer PHP versions.
It is recommended to use the recommended alternatives or custom variables to ensure long-term compatibility and stability of PHP code.
The following predefined variables are deprecated and should be replaced by the new versions:
| Replace | With |
|---|---|
$HTTP_SERVER_VARS |
$_SERVER |
$HTTP_GET_VARS |
$_GET |
$HTTP_POST_VARS |
$_POST |
$HTTP_POST_FILES |
$_FILES |
$HTTP_SESSION_VARS |
$_SESSION |
$HTTP_ENV_VARS |
$_ENV |
$HTTP_COOKIE_VARS |
$_COOKIE |
$php_errormsg |
error_get_last() |