1.2.219. Const Or Define¶
const
and define()
have the same functional use : create constants.
The analyzed code has less than 10% of one of them : for consistency reasons, it is recommended to make them all the same.
They are almost interchangeable, though not totally : define()
allows the creation of case-insensitive constants, while Const
won't.
<?php
// be consistent
const A1 = 1 ;
const A2 = 2 ;
const A3 = 3 ;
const A4 = 4 ;
const A5 = 5 ;
const A6 = 6 ;
const A7 = 7 ;
const A8 = 8 ;
const A9 = 9 ;
const A10 = 10;
const A11 = 11;
define('A12', 12); // Be consistent, always use the same.
?>
1.2.219.1. Connex PHP features¶
1.2.219.1.1. Specs¶
Short name |
Structures/ConstDefineFavorite |
Rulesets |
|
Exakat since |
0.12.1 |
PHP Version |
All |
Severity |
|
Time To Fix |
|
Precision |
Very high |
Available in |