3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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();
based on s1Orj
Output for 7.0.0 - 7.2.0
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.3.20 - 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.