3v4l.org

run code in 200+ php & hhvm versions
<?php $q = new SplQueue(); $q->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO); $q->setIteratorMode(SplDoublyLinkedList::IT_MODE_LIFO); $q->enqueue(1); $q->enqueue(2); foreach ($q as $elt) { var_dump($elt); }
based on FJSOV
Output for 7.1.20 - 7.2.6
Fatal error: Uncaught RuntimeException: Iterators' LIFO/FIFO modes for SplStack/SplQueue objects are frozen in /in/RhYP0:5 Stack trace: #0 /in/RhYP0(5): SplDoublyLinkedList->setIteratorMode(2) #1 {main} thrown in /in/RhYP0 on line 5
Process exited with code 255.
Output for 5.6.0 - 5.6.30, 7.0.0 - 7.1.9
int(2) int(1)
Output for hhvm-3.18.4 - 3.21.0
Fatal error: Uncaught exception 'RuntimeException' with message 'Iterators' LIFO/FIFO modes for SplStack/SplQueue objects are frozen' in /in/RhYP0:5 Stack trace: #0 /in/RhYP0(5): SplQueue->setIteratorMode() #1 {main}
Process exited with code 255.