« Ds\Sequence::find
Ds\Sequence::get »

Ds\Sequence::first

(PECL ds >= 1.0.0)

Ds\Sequence::first — Returns the first value in the sequence

説明

abstract public function Ds\Sequence::first(): mixed

Returns the first value in the sequence.

パラメータ

この関数にはパラメータはありません。

戻り値

The first value in the sequence.

エラー / 例外

UnderflowException if empty.

例

例1 Ds\Sequence::first() example

<?php
$sequence = new \Ds\Vector([1, 2, 3]);
var_dump($sequence->first());
?>

上の例の出力は、 たとえば以下のようになります。

int(1)
関連キーワード:
first   sequence   Sequence   find   abstract   mixed   UnderflowException   empty   example   Vector   dump
関連する関数・ページ:
ds-sequence.shift   ds-sequence.sum   ds-sequence.get   ds-sequence.pop   ds-set.first   ds-sequence.push