"/>
Home / CSE MCQs / PHP MCQs :: Discussion

Discussion :: PHP MCQs

  1. What will be the output of the following PHP code?
    < ?php      $fruits = array ("apple", "mango", "peach", "pear",     "orange");     $subset = array_slice ($fruits, 2);     print_r ($subset); ?>
  2. A.
    Array ( [0] => peach )
    B.
    Array ( [0] => apple [1] => mango [2] => peach )
    C.
    Array ( [0] => apple [1] => mango )
    D.
    Array ( [0] => peach [1] => pear [2] => orange )

    View Answer

    Workspace

    Answer : Option D

    Explanation :

    The array_slice() function returns a section of an array based on a starting and ending offset value.


Be The First To Comment