Q. Which of the following is a correct way to create an array in PHP?

  • (A) $arr = array(1, 2, 3);
  • (B) $arr = array{1, 2, 3};
  • (C) $arr = [1 -> 2 -> 3];
  • (D) $arr = array[1, 2, 3];
πŸ’¬ Discuss
βœ… Correct Answer: (A) $arr = array(1, 2, 3);
Explanation: The array() function is used to declare arrays in PHP.
Explanation by: Rati Dubey
The array() function is used to declare arrays in PHP.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
86
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Rati Dubey
Publisher
πŸ“ˆ
83%
Success Rate