Ds\Queue::peek

(PECL ds >= 1.0.0)

Ds\Queue::peekReturns the value at the front of the queue

說明

public Ds\Queue::peek(): mixed

Returns the value at the front of the queue, but does not remove it.

參數(shù)

此函數(shù)沒有參數(shù)。

返回值

The value at the front of the queue.

錯(cuò)誤/異常

UnderflowException if empty.

范例

示例 #1 Ds\Queue::peek() example

<?php
$queue 
= new \Ds\Queue();

$queue->push("a");
$queue->push("b");
$queue->push("c");

var_dump($queue->peek());
?>

以上例程的輸出類似于:

string(1) "a"