Mirco Blitz wrote: > HI, > I am really confused. > I have an array, that looks like this: > > print_r($elementsarr) = Array ( [0] => knr [1] => subject [2] => title [3] > => kat [4] => pages [5] => access [6] => dofile [7] => MAX_FILE_SIZE [8] > => > pdf [9] => dolink [10] => link [11] => erstam [12] => endless [13] => from > [14] => until [15] => openbem [16] => history [17] => closedbem [18] => > [19] > => b [20] => br [21] => bw [22] => bay [23] => h [24] => hb [25] => hh > [26] > => mv [27] => n [28] => nw [29] => rp [30] => s [31] => sa [32] => sh [33] > => sn [34] => t [35] => bund ) > > Now i try to work with this array in a foreach. > > foreach($elementsarr as $key=>$tmp); > { > echo "$key=>$tmp<br>"; > } > > Now the result of that is: > > 35=>bund > > Ist not the first time i work with foreach. But it is the first time it > just > returns the last value. > > Do you have an idea why? Perhaps you need to use http://php.net/reset You see, when you do foreach or each or any of those, there is an "internal" setting in the array that is altered to keep track of where you are. Kind of like a big "You are here" arrow inside the guts of the array. If you've gone through the whole thing already, you have to reset the internal point back to the beginning. "Be Kind, Rewind!" TIP: Put a 'reset' before anything that loops the array. That way, if you add something before it that loops through, it can't cause the side-effect of a bug in your other code. Just a good habit to form. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php