Home »
MCQs »
PHP MCQs
Give an example, how to define a constant array in PHP?
79. Give an example, how to define a constant array in PHP?
- const cities = new array(["New Delhi","Mumbai","Banglore"]);
- define("cities"=["New Delhi","Mumbai","Banglore"]);
- define("cities", ["New Delhi","Mumbai","Banglore"]);
- define("cities":["New Delhi","Mumbai","Banglore"]);
Answer: C) define("cities", ["New Delhi","Mumbai","Banglore"]);
Explanation:
The PHP define() function can also be used to create a constant array, here is an example:
define("cities", ["New Delhi","Mumbai","Banglore"]);