Arrays/slices
Last updated
A slice/array is a sequence of elements. They are zero indexed, not a fixed size and can be modified on the fly.
[1, 2, 3][$someArray..., 4][1, 2, 3].filter($this % 2 == 0)$someArray[1]Accessing last array index
$someArray[len($someArray)-1]The range index syntax can be a powerful tool: [start:end]
The result will be a new array containing the given range of indexes from start to end.
Last updated
$someArray[0:4]$someArray[ len($someArray)-6 : len($someArray)-1 ]