Home / CSE MCQs / PHP MCQs :: Discussion

Discussion :: PHP MCQs

  1. Which 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);
  2. A.
    (iii) and (iv)
    B.
    (ii) and (iii)
    C.
    Only (i)
    D.
    (ii), (iii) and (iv)

    View Answer

    Workspace

    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.


Be The First To Comment