Why in php array_slice() order is indicated by 1 more? Suppose I need to select the first 4 elements of the array, I do it like this - @array_slice($data, 0, 4) but according to logic 0 - первый, 1 - второй, 2 - третий, 3 - четвертый . That is, the "slice" is 0-3 (inclusive). But it works exactly 0, 4 .

  • The first argument is the initial element - 0 (that is, the first element in the array), the second argument is the number of elements from the current position - 4, what is not clear then? ) - RifmaMan
  • 2
    But you specify the number, not the final index. - user207618

0