.. _constants-constdefinepreference: .. _const-or-define-preference: Const Or Define Preference ++++++++++++++++++++++++++ ``Const`` and `define() `_ have almost the same functional use : they create constants. The analyzed code has less than 10% of one of them : for consistency reasons, it is recommended to make constant definition consistent. It is recommended to use ``const`` for global constants, as this keyword is processed at compile time, while `define() `_ is executed. Note that `define() `_ used to allow the creation of case-insensitive constants, but this is deprecated since PHP 7.3 and will be removed in PHP 8.0. .. code-block:: php See also `Constant definition `_ and `Define `_. Connex PHP features ------------------- + `define `_ + `const `_ + `constant `_ Specs _____ +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Short name | Constants/ConstDefinePreference | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Rulesets | :ref:`All `, :ref:`Changed Behavior `, :ref:`Preferences ` | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Exakat since | 1.3.9 | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | PHP Version | All | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Severity | | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Time To Fix | | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Precision | Very high | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Available in | `Entreprise Edition `_, `Exakat Cloud `_ | +--------------+-------------------------------------------------------------------------------------------------------------------------+