PHP 8.3.0 RC 6 available for testing

SplPriorityQueue::next

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

SplPriorityQueue::nextMove to the next node

说明

public SplPriorityQueue::next(): void

Extracts the top node from the queue.

参数

此函数没有参数。

返回值

没有返回值。

add a note

User Contributed Notes 1 note

up
0
ivail89 at mail dot ru
2 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