fork(1) download
  1. <?php
  2.  
  3. $input = array("a", "b", "c", "d", "e");
  4.  
  5.  
  6.  
  7. // заметьте разницу в индексах массивов
  8. print_r($input);
  9. print_r(array_slice($input, 2, -1));
  10. print_r($input);
  11.  
Success #stdin #stdout 0.02s 24400KB
stdin
Standard input is empty
stdout
Array
(
    [0] => a
    [1] => b
    [2] => c
    [3] => d
    [4] => e
)
Array
(
    [0] => c
    [1] => d
)
Array
(
    [0] => a
    [1] => b
    [2] => c
    [3] => d
    [4] => e
)