3v4l.org

run code in 300+ PHP versions simultaneously
<?php $list1 = new \SplDoublyLinkedList(); $list1->push(1); $list1->push(2); $list2 = clone $list1; $list2->push(3); $list2->push(4); var_export(iterator_to_array($list1)); print "\n"; var_export(iterator_to_array($list2)); print "\n";
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.30, 8.2.0 - 8.2.25, 8.3.0 - 8.3.13
array ( 0 => 1, 1 => 2, ) array ( 0 => 1, 1 => 2, 2 => 3, 3 => 4, )

preferences:
86.44 ms | 407 KiB | 5 Q