array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'ja', ), 'this' => array ( 0 => 'ds-set.first.php', 1 => 'Ds\\Set::first', 2 => 'Returns the first value in the set', ), 'up' => array ( 0 => 'class.ds-set.php', 1 => 'Ds\\Set', ), 'prev' => array ( 0 => 'ds-set.filter.php', 1 => 'Ds\\Set::filter', ), 'next' => array ( 0 => 'ds-set.get.php', 1 => 'Ds\\Set::get', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/ds/ds/set/first.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

Ds\Set::first

(PECL ds >= 1.0.0)

Ds\Set::firstReturns the first value in the set

説明

public Ds\Set::first(): mixed

Returns the first value in the set.

パラメータ

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

戻り値

The first value in the set.

エラー / 例外

UnderflowException if empty.

例1 Ds\Set::first() example

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

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

int(1)