RE: [PHP] Foreach problem.

From: Date: Wed, 09 Feb 2005 23:06:34 +0000
Subject: RE: [PHP] Foreach problem.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-208398@lists.php.net to get a copy of this message
> 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 [snip] > => 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 The array that you are trying to use foreach on is a numerically indexed array (note the [0] => knr, etc) - this might explain your problem! Mikey

« previous php.general (#208398) next »