php8.5
Home/ Manual/ ds / sequence/ Ds\Sequence::last

Ds\Sequence::last

PHP function Edit on GitHub ✎

(PECL ds >= 1.0.0)

Returns the last value

Description

Ds\Sequence::last(): mixed

Returns the last value in the sequence.

Parameters Parameters

Return Values

The last value in the sequence.

Errors/Exceptions

UnderflowException if empty.

Examples

Ds\Sequence::last() example

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

The above example will output something similar to:

output
int(3)

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