Extract a slice of the current array with specific offset.

/**
 * Extract a slice of the current array with specific offset.
 *
 * @param int      $offset       Slice begin index.
 * @param bool     $preserveKeys Whether array keys are preserved or no. Default is false.
 */
public function offset(int $offset, bool $preserveKeys = false): self

Examples

$arrays = Arrays::create(['a', 'b', 'c', 'd', 'e'])->offset(3);

$result = $arrays->toArray();

print_r($result);

The above example will output:

Array
(
    [0] => d
    [1] => e
)

Getting Started

Methods