See this line in a code:
// Define E_USER_DEPRECATED for PHP < 5.3.if (!defined("E_USER_DEPRECATED")) define('E_USER_DEPRECATED', E_USER_WARNING);
There are two system constants at the same time in http://php.net/manual/zh/errorfunc.constants.php. function seems to be the same. What difference do they have?
E_deprecated and e_user_deprecated are two new error levels in PHP 5.3, does it mean that we should take the new one first? Is it recommended to discard e_user_warning?
Reply content:
See this line in a code:
// Define E_USER_DEPRECATED for PHP < 5.3.if (!defined("E_USER_DEPRECATED")) define('E_USER_DEPRECATED', E_USER_WARNING);
There are two system constants at the same time in http://php.net/manual/zh/errorfunc.constants.php. function seems to be the same. What difference do they have?
E_deprecated and e_user_deprecated are two new error levels in PHP 5.3, does it mean that we should take the new one first? Is it recommended to discard e_user_warning?
WARNING and DEPRECATED have different semantics, it is recommended to check the dictionary first to find out what they mean in English.
Returning to this specific scenario, DEPRECATED indicates that the functionality used is deprecated, and it is usually written in a document that suggests a different way to do it.
WARNING indicates a warning, such as a parameter that passed the wrong format, because of possible incorrect usage.
Since e_user_deprecated was introduced in 5.3, e_user_deprecated can be defined as e_user_warning before 5.3, which is only a workaround and does not mean the same thing.