3v4l.org

run code in 300+ PHP versions simultaneously
<?php $zrob = function () { static $x=0; echo ++$x."\n"; }; $q = new SplQueue(); $q->setIteratorMode(SplDoublyLinkedList::IT_MODE_DELETE); $q->enqueue($zrob); $q->enqueue($zrob); $z = $q->dequeue(); $z(); $z = $q->dequeue(); $z(); $z = $q->dequeue(); $z();
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
1 2 Fatal error: Uncaught RuntimeException: Can't shift from an empty datastructure in /in/16gaQ:16 Stack trace: #0 /in/16gaQ(16): SplQueue->dequeue() #1 {main} thrown in /in/16gaQ on line 16
Process exited with code 255.
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.21
1 2 Fatal error: Uncaught exception 'RuntimeException' with message 'Can't shift from an empty datastructure' in /in/16gaQ:16 Stack trace: #0 /in/16gaQ(16): SplQueue->dequeue() #1 {main} thrown in /in/16gaQ on line 16
Process exited with code 255.

preferences:
184.49 ms | 402 KiB | 178 Q