Give an example, how to define a constant array in PHP?

79. Give an example, how to define a constant array in PHP?

  1. const cities = new array(["New Delhi","Mumbai","Banglore"]);
  2. define("cities"=["New Delhi","Mumbai","Banglore"]);
  3. define("cities", ["New Delhi","Mumbai","Banglore"]);
  4. 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"]);

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.