PHP MCQ Arrays in PHP MCQ Question #2380
MCQ Single Best Answer Not Set

QWhich of the following are correct ways of creating an array?
(i) state[0] = "karnataka";
(ii) $state[] = array("karnataka");
(iii) $state[0] = "karnataka";
(iv) $state = array("karnataka");

ID: #2380 Arrays in PHP MCQ 1,662 views
Question Info
#2380Q ID
Not SetDifficulty
Arrays in PHP MCQTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A (iii) and (iv)
  • B (ii) and (iii)
  • C Only (i)
  • D (ii), (iii) and (iv)
Correct Answer: Option A

Explanation

A variable name should start with $ symbol which is not present in i) and you need not put the square brackets when you use the array() constructor.

Share This Question

Challenge a friend or share with your study group.