PHP MCQ Arrays in PHP MCQ Question #2380
Single Choice 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,672 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

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.