Removes and returns the first value

Ds\Vector::shift

(PECL ds >= 1.0.0)

Ds\Vector::shiftRemoves and returns the first value

說明

public Ds\Vector::shift(): mixed

Removes and returns the first value.

參數

此函式沒有參數。

返回值

The first value, which was removed.

錯誤/異常

UnderflowException if empty.

範例

示例 #1 Ds\Vector::shift() example

<?php
$vector 
= new \Ds\Vector(["a""b""c"]);

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

以上例程的輸出類似於:

string(1) "a"
string(1) "b"
string(1) "c"

Leave a Reply

Your email address will not be published. Required fields are marked *