Q. How do you create an associative array in PHP?

  • (A) $arr = array('key' => 'value');
  • (B) $arr = ['key' => 'value'];
  • (C) Both 1 and 2
  • (D) $arr = associative('key', 'value');
πŸ’¬ Discuss
βœ… Correct Answer: (C) Both 1 and 2
Explanation: PHP allows associative arrays using both array() and [] syntax.
Explanation by: Rati Dubey
PHP allows associative arrays using both array() and [] syntax.

πŸ’¬ Discussion


πŸ“Š Question Analytics

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