RE: [PHP] traverse a multidimensional array

From: Date: Thu, 20 Jul 2000 18:49:20 +0000
Subject: RE: [PHP] traverse a multidimensional array
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-7453@lists.php.net to get a copy of this message
In article <637C00F0303AD311BCCC009027887A7C420DAF@tiger.wild.net>, Chris.Boget@wild.net ("Boget, Chris") wrote: be sure to use the is_array() function to test each key/value pair. That way you can traverse another level of the array or print out the current value. Jeff >> 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 (#7453) next »