Create a queue with value-priorities

Code
<?php

// SplPriorityQueue is more like a heap
$queue = new SplPriorityQueue();

$queue->insert('second'2);
$queue->insert('third'1);
$queue->insert('first'3);

foreach (
$queue as $element) {
    
// returns value by default
    
echo $element PHP_EOL;
}

echo 
'count: ' count($queue);
Result
first
second
third
count: 0
Used Versions
PHP 7.1, Zend 3.0, Symfony 3.2, Laravel 5.2, PHPUnit 5.6, Doctrine 2.6