php8.5
Home/ Manual/ ds / map/ Ds\Map::skip

Ds\Map::skip

PHP function Edit on GitHub ✎

(PECL ds >= 1.0.0)

Returns the pair at a given positional index

Description

Ds\Map::skip(int $position): Ds\Pair

Returns the pair at a given zero-based position.

Parameters

position

The zero-based positional index to return.

Return Values

Returns the Ds\Pair at the given position.

Errors/Exceptions

OutOfRangeException if the position is not valid.

Examples

Ds\Map::skip() example

php
<?php
$map = new \Ds\Map(["a" => 1, "b" => 2, "c" => 3]);

var_dump($map->skip(1));
?>

The above example will output something similar to:

output
object(Ds\Pair)#2 (2) {
  ["key"]=>
  string(1) "b"
  ["value"]=>
  int(2)
}

Source: reference/ds/ds/map/skip.xml · from the official PHP manual (php/doc-en)