PHP 8.4.2 Released!

SplPriorityQueue::next

(PHP 5 >= 5.3.0, PHP 7, PHP 8)

SplPriorityQueue::nextMove to the next node

Açıklama

public SplPriorityQueue::next(): void

Extracts the top node from the queue.

Bağımsız Değişkenler

Bu işlevin bağımsız değişkeni yoktur.

Dönen Değerler

Hiçbir değer dönmez.

add a note

User Contributed Notes 1 note

up
0
ivail89 at mail dot ru
3 years ago
Method 'next' deletes node from top. See example:
<?php
$queue
= new SplPriorityQueue();

$queue->insert('Q', 5);
$queue->insert('W', 1);
$queue->insert('E', 4);
$queue->insert('R', 2);
$queue->insert('Y', 3);

$queue->next();
$queue->next();
$queue->next();

print_r($queue);
?>

Will be output:

SplPriorityQueue Object
(
[flags:SplPriorityQueue:private] => 1
[isCorrupted:SplPriorityQueue:private] =>
[heap:SplPriorityQueue:private] => Array
(
[0] => Array
(
[data] => R
[priority] => 2
)

[1] => Array
(
[data] => W
[priority] => 1
)

)

)
To Top