PHP 8.1.28 Released!

SplPriorityQueue::count

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

SplPriorityQueue::countキュー内の要素数を数える

説明

public SplPriorityQueue::count(): int

パラメータ

この関数にはパラメータはありません。

戻り値

キュー内の要素数を返します。

add a note

User Contributed Notes 1 note

up
1
xedin dot unknown at gmail dot com
5 years ago
After iteration, the queue will be empty. Therefore, `count()` will return 0. You can circumvent this by iterating over a clone, instead of the actual queue.

https://stackoverflow.com/questions/27464012/splpriorityqueuenext-is-removing-the-item
To Top