1--TEST-- 2SPL: SplPriorityQueue: top and extract flags 3--CREDITS-- 4Nathaniel McHugh nat@fishtrap.co.uk 5#testfest London 2009-05-09 6--FILE-- 7<?php 8 9$priorityQueue = new SplPriorityQueue(); 10 11var_dump($priorityQueue->getExtractFlags()); 12 13$priorityQueue->insert("a", 1); 14$priorityQueue->insert("b", 2); 15$priorityQueue->insert("c", 0); 16 17echo "EXTR DEFAULT",PHP_EOL; 18echo "value: ",$priorityQueue->top(),PHP_EOL; 19 20$priorityQueue->setExtractFlags(SplPriorityQueue::EXTR_PRIORITY); 21var_dump($priorityQueue->getExtractFlags() & SplPriorityQueue::EXTR_PRIORITY); 22 23echo "EXTR_PRIORITY",PHP_EOL; 24echo "priority: ",$priorityQueue->top(),PHP_EOL; 25 26$priorityQueue->setExtractFlags(SplPriorityQueue::EXTR_BOTH); 27echo "EXTR_BOTH",PHP_EOL; 28print_r($priorityQueue->top()); 29 30echo "EXTR_DATA",PHP_EOL; 31$priorityQueue->setExtractFlags(SplPriorityQueue::EXTR_DATA); 32echo "value: ",$priorityQueue->top(),PHP_EOL; 33?> 34--EXPECT-- 35int(1) 36EXTR DEFAULT 37value: b 38int(2) 39EXTR_PRIORITY 40priority: 2 41EXTR_BOTH 42Array 43( 44 [data] => b 45 [priority] => 2 46) 47EXTR_DATA 48value: b 49