$dll = new SplDoublyLinkedList();
$dll->push(2);
$dll->push(3);
$dll->unshift(5); // add 5 beginning of the array
$dll->rewind();
while($dll->valid()){
    echo $dll->current()."\n";
    $dll->next();
}
Output 
5
2
3(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SplDoublyLinkedList::unshift — Ajoute un élément à la liste
   Ajoute un élément ayant pour valeur value
   au début de la liste.
  
valueLa valeur.
Aucune valeur n'est retournée.
$dll = new SplDoublyLinkedList();
$dll->push(2);
$dll->push(3);
$dll->unshift(5); // add 5 beginning of the array
$dll->rewind();
while($dll->valid()){
    echo $dll->current()."\n";
    $dll->next();
}
Output 
5
2
3