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

Ds\Vector::first

(PECL ds >= 1.0.0)

Ds\Vector::firstReturns the first value in the vector

Опис

public Ds\Vector::first(): mixed

Returns the first value in the vector.

Параметри

У цієї функції немає параметрів.

Значення, що повертаються

The first value in the vector.

Помилки/виключення

UnderflowException if empty.

Приклади

Приклад #1 Ds\Vector::first() example

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

Поданий вище приклад виведе щось схоже на:

int(1)