3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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";
based on Yl1v9
Output for 5.6.0 - 5.6.30, 7.0.0 - 7.2.6
array ( 0 => 1, 1 => 2, ) array ( 0 => 1, 1 => 2, 2 => 3, 3 => 4, )
Output for hhvm-3.12.14 - 3.17.3
array ( 0 => 1, 1 => 2, 2 => 3, 3 => 4, ) array ( 0 => 1, 1 => 2, 2 => 3, 3 => 4, )