PHP's DoublyLinkedList

Code
<?php

$list 
= new SplDoublyLinkedList();

// adding elements with push or unshift
$list->push(1);
$list->push(10);
$list->push(100);

$list->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO);
loop($list);

$list->setIteratorMode(SplDoublyLinkedList::IT_MODE_LIFO
SplDoublyLinkedList::IT_MODE_DELETE);
loop($list);

echo 
'count: ' count($list);

function 
loop(Traversable $list) {
    foreach (
$list as $element) {
        echo 
$element PHP_EOL;
    }
}
Result
1
10
100
100
10
1
count: 0
Used Versions
PHP 8.2, Laminas MVC 3.2, Symfony 5.2, Laravel 8.28, PHPUnit 9.5, Doctrine ORM 2.8