1--TEST-- 2SPL: DoublyLinkedList: std operations 3--FILE-- 4<?php 5$dll = new SplDoublyLinkedList(); 6// errors 7try { 8 $dll->pop(); 9} catch (RuntimeException $e) { 10 echo "Exception: ".$e->getMessage()."\n"; 11} 12try { 13 $dll->shift(); 14} catch (RuntimeException $e) { 15 echo "Exception: ".$e->getMessage()."\n"; 16} 17 18// data consistency 19$a = 2; 20$dll->push($a); 21echo $dll->pop()."\n"; 22 23$a = 2; 24$dll->unshift($a); 25echo $dll->shift()."\n"; 26 27// peakable 28$dll->push(1); 29$dll->push(2); 30echo $dll->top()."\n"; 31echo $dll->bottom()."\n"; 32$dll->pop(); 33$dll->pop(); 34 35// countable 36$dll->push(NULL); 37$dll->push(NULL); 38echo count($dll)."\n"; 39echo $dll->count()."\n"; 40var_dump($dll->pop()); 41var_dump($dll->pop()); 42 43// clonable 44$dll->push(2); 45$dll_clone = clone $dll; 46$dll_clone->pop(); 47echo count($dll)."\n"; 48?> 49--EXPECT-- 50Exception: Can't pop from an empty datastructure 51Exception: Can't shift from an empty datastructure 522 532 542 551 562 572 58NULL 59NULL 601 61