« Ds\Vector::merge
Ds\Vector::push »

Ds\Vector::pop

(PECL ds >= 1.0.0)

Ds\Vector::pop — Removes and returns the last value

説明

public function Ds\Vector::pop(): mixed

Removes and returns the last value.

パラメータ

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

戻り値

The removed last value.

エラー / 例外

UnderflowException if empty.

例

例1 Ds\Vector::pop() example

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

var_dump($vector->pop());
var_dump($vector->pop());
var_dump($vector->pop());
?>

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

int(3)
int(2)
int(1)
関連キーワード:
Vector   last   Removes   vector   dump   merge   push   mixed   removed   UnderflowException   empty   example
関連する関数・ページ:
ds-vector.last   ds-vector.clear   ds-vector.sum   ds-vector.shift   ds-vector.get   ds-vector.construct