我试图对使用此工具生成的双向链表动画进行逆向工程:
所以我试过这个:
<?php
$dll = new \SplDoublyLinkedList();
$dll->unshift(200);//inserir no início
$dll->unshift(100);//inserir no início
$dll->push(34);//inserir no final
$dll->push(35);//inserir no final
$dll->add(2, 3); //inserir em posicao específica
$dll->unshift(670);//inserir no início
$dll->add(($dll->count() / 2)-1, 450);//inserir no meio
$dll->pop(); //remover do final
$dll->shift(); //remover do início
$dll->offsetUnset(1);//remover de posicao específica
$prev = null;
$dll->rewind(); //rebobinando
while ($dll->valid()) {
$current = $dll->current();
echo 'Atual: '.$current, "\n";
$dll->next();
}
但是结果与动画不同:(如何模仿这个双向链表动画并获得相同的结果?
哆啦的时光机