Home / CSE / PHP - CS :: Discussion

Discussion :: PHP - CS

  1. Which of the following are correct ways of creating an array?
    1. state[0] = “karnataka”;
    2. $state[] = array(“karnataka”);
    3. $state[0] = “karnataka”;
    4. $state = array(“karnataka”);

  2. A.

     3 and 4

    B.

     2 and 3

    C.

     Only 1

    D.

     2, 3 and 4

    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