CakeFest 2024: The Official CakePHP Conference

Ds\Vector::first

(PECL ds >= 1.0.0)

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

Description

public Ds\Vector::first(): mixed

Returns the first value in the vector.

Liste de paramètres

Cette fonction ne contient aucun paramètre.

Valeurs de retour

The first value in the vector.

Erreurs / Exceptions

UnderflowException if empty.

Exemples

Exemple #1 Ds\Vector::first() example

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

Résultat de l'exemple ci-dessus est similaire à :

int(1)
add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top