1.2.391. Dynamic Class Constant¶
This is the list of dynamic calls to class constants.
Constant may be dynamically called with the constant() function. In PHP 8.3, they may also be called with a new dedicated syntax.
<?php
// Dynamic access to 'E_ALL'
echo constant('E_ALL');
interface i {
const MY_CONSTANT = 1;
}
// Dynamic access to 'E_ALL'
$constantName = 'MY_CONSTANT';
echo constant('i::'.$constantName);
// With PHP 8.3 :
echo i::{$constantName};
?>
1.2.391.1. Connex PHP features¶
1.2.391.1.1. Specs¶
Short name |
Classes/DynamicConstantCall |
Rulesets |
|
Exakat since |
0.8.4 |
PHP Version |
All |
Severity |
|
Time To Fix |
|
Precision |
Very high |
Available in |