CakeFest 2024: The Official CakePHP Conference

Ds\Queue::peek

(PECL ds >= 1.0.0)

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

Descripción

public Ds\Queue::peek(): mixed

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

Parámetros

Esta función no tiene parámetros.

Valores devueltos

The value at the front of the queue.

Errores/Excepciones

UnderflowException if empty.

Ejemplos

Ejemplo #1 Ds\Queue::peek() example

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

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

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

El resultado del ejemplo sería algo similar a:

string(1) "a"
add a note

User Contributed Notes

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