How do you define a constant in PHP?
Correct answer
D. define()
17 views
D. define()
17 views
define() creates a constant at run time, as in define("SITE_NAME", "MCQsExam");. The value cannot be changed afterwards, and constants are written without a leading $.
PHP also provides the const keyword for constants declared at compile time, including inside classes, but it is a keyword rather than the function const() shown in the options.
Keep preparing with more Computer Science MCQs on MCQsExam.com.
Not sure why the answer is D? Ask here and get an explanation.