RE: [PHP] traverse a multidimensional array

From: Date: Thu, 20 Jul 2000 13:58:45 +0000
Subject: RE: [PHP] traverse a multidimensional array
Groups: php.general 
Request: Send a blank email to php-general+get-7415@lists.php.net to get a copy of this message
> Now I want to list the data in there. I tried using: > //check that our local array has the correct data > while(list($key,$value)=each($arrResult)) { > echo "array[$key]=$value<br>\n"; > }> but all I get is: > array[0]=Array > array[1]=Array > array[2]=Array > array[3]=Array > array[4]=Array > How do I list the contents of each "second level" array? (not > sure of the correct terms) Same as you did the first: while(list($key,$value)=each($arrResult)) { echo "array[$key]=$value<br>\n"; while( list( $key2, $value2 ) = each( $value )) { echo "$key2 = $value2<br>\n"; } } Chris

« previous php.general (#7415) next »