3
我有以下代码:PHP的foreach SplPriorityQueue - 找不到元素
$friendsOrdered= new SplPriorityQueue();
... // Code to fill up the priority queue
print_r($friendsOrdered);
$i = 0;
foreach($friendsOrdered as $f) {
}
echo "<br><br>";
print_r($friendsOrdered);
当我看打印的输出,我可以看到,在循环后的优先级队列为空。有没有办法阻止移除元素的foreach?
谢谢!
或更好的迭代克隆。 – hakre 2011-12-27 16:57:45