PHP

PHP

By DeepSource

Defining case-insensitive constants is deprecatedPHP-W1083

Bug risk
Has Autofix

Argument #3 ($case_insensitive) in define function can be use to a define case-insensitive constant. However as per the official documentation,

Defining case-insensitive constants is deprecated as of PHP 7.3.0. As of PHP 8.0.0, only false is an acceptable value, passing true will produce a warning.

Examples

// Bad practice
define('ACTIVE', 1, true);  // Argument #3 is ignored since declaration of case-insensitive constants is no longer supported as of PHP 8.0.0
define('IN_ACTIVE', 0, false);

// Recommended
define('ACTIVE', 1);
define('IN_ACTIVE', 0);