php while and foreach loop will not work [closed]

Reforced

New Member
Please don't make me give you the "I'm not stupid speech"...But, has anybody ever experienced a while loop or a foreach loop not looping through an array? (LOL!) (I'm just trying keep myself from crying:(Imagine the simplest while loop 2/3rds the way down my page that just won't work. I have tried everything, checked everything, it will go once, but not twice. No matter what I try.I put the loop in a test page and it worked! But not in the script I need it to. I have checked all my curly brackets to make sure they are open closed properly. There are no echos on this page, it is merely doing a lot comparing and sorting.I have tried reset(), though it didn't need it.The only echo's I put in were for testing, that is how I know it will get the first instance of the array and echo it, but then it goes into an endless loop, and have to stop the page...Just as I was writing this I tried putting next() in the loop and it still wont advance the pointer. There are other while loops in the page, before this one, that are working just fine. I added this one to sort through an array and...it won't work???Has anybody had this experience?the code is:\[code\]foreach($array as $key => $value){ echo $key;}\[/code\]I know, pretty simple, just won't work???
 
Back
Top