Home » PHP » PHP Sorting Arrays » Question
  1. What will be the output of the following PHP code?
    <?php
    $num = array ("Zero","One", "Two", "Three", "Four","Five");
    $subset = array_slice ($num, 2);
    print_r ($subset);
    ?>
    1. Array
      (
      [0] => Two
      [1] => Three
      )
    2. Array
      (
      [0] => Two
      [2] => Four
      [3] => Five
      )
    3. Array
      (
      [2] => Four
      [3] => Five
      )
    4. Array
      (
      [0] => Two
      [1] => Three
      [2] => Four
      [3] => Five
      )
    5. None of these
Correct Option: D

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



Your comments will be displayed only after manual approval.