Get elements starting at given index (default=1) to the end

array:rest(ARRAY $array, INT $index=1) : ARRAY

$arr = ['A', 'B', 'C', 'D']

array:rest($arr)
#=> [
#=>     "B",
#=>     "C",
#=>     "D"
#=> ]

array:rest($arr, 2)
#=> [
#=>     "C",
#=>     "D"
#=> ]

# index 0, gives you all the array
array:rest($arr, 0)
#=> [
#=>     "A",
#=>     "B",
#=>     "C",
#=>     "D"
#=> ]

# if given index is out of range, it returns []
array:rest($arr, 10)
#=> []

Copyright ©2013-2022 SunSed®. All rights reserved.