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
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SplPriorityQueue::count — Производит подсчёт элементов в очереди
У этой функции нет параметров.
Возвращает количество элементов в очереди.
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