|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-07-12 04:28 UTC] scottmac@php.net
-Status: Open
+Status: Bogus
[2011-07-12 04:28 UTC] scottmac@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 00:00:02 2025 UTC |
Description: ------------ I tried to loop through a SplMaxHeap object multiple times but it only loops once. As there is no option to reset or rewind the heap object I don't see a way to loop through it multiple times. I noticed that $heap->count() decreases with every loop cycle, perhaps that is the reason. Test script: --------------- $heap = new SplMaxHeap(); $heap->insert(1); $heap->insert(2); foreach($heap as $number){ echo $number."\n"; } foreach($heap as $number){ echo $number."\n"; } Expected result: ---------------- 2 1 2 1 Actual result: -------------- 2 1