$dll = new SplDoublyLinkedList();$dll->push(2);$dll->push(3);$dll->unshift(5);$dll->rewind(); // starting from beginning without this it will not workwhile($dll->valid()){ echo $dll->current()."\n"; $dll->next();}//Output523
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SplDoublyLinkedList::rewind — Возвращает итератор в начало
У этой функции нет параметров.
Функция не возвращает значения после выполнения.
$dll = new SplDoublyLinkedList();$dll->push(2);$dll->push(3);$dll->unshift(5);$dll->rewind(); // starting from beginning without this it will not workwhile($dll->valid()){ echo $dll->current()."\n"; $dll->next();}//Output523