Which PHP 8.3 feature allows declaring a constant on a trait?
-
A
trait constants
Correct answer
-
B
class constants
-
C
interface constants
-
D
enum constants
Correct answer
A. trait constants
13 views
Explanation
PHP 8.3 adds trait const so traits can now define constants that become part of the composing class.
Doubts & discussion
Not sure why the answer is A? Ask here and get an explanation.
Ask a doubt about this MCQ