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

  • (A) $arr = ['name' => 'John', 'age' => 25];
  • (B) $arr = {name: 'John', age: 25};
  • (C) $arr = ('name' => 'John', 'age' => 25);
  • (D) $arr = array('John', 25);
πŸ’¬ Discuss
βœ… Correct Answer: (A) $arr = ['name' => 'John', 'age' => 25];
Explanation: Associative arrays use key => value pairs.
Explanation by: Rati Dubey
Associative arrays use key => value pairs.

πŸ’¬ Discussion


πŸ“Š Question Analytics

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