Re: keys re-ordered after array_pop()

From: Date: Fri, 06 Oct 2000 16:45:04 +0000
Subject: Re: keys re-ordered after array_pop()
Groups: php.general 
Request: Send a blank email to php-general+get-18941@lists.php.net to get a copy of this message
Boys and Girls: This was sent to me off-list but figure it'd be good to have it on the list. --Dan ------------------------------> Hi Daniel, Sorry, I was being terse. I test for $value being an array and if so I expand that also: while( list( $key, $value ) = each ( $HTTP_POST_VARS ) ) { if( is_array( $value ) ) { while( list( $key2, $value2 ) = each( $value ) ) { print( $key2 . " -> " . $value2 . "<br>\n" ); } } else { print( $key . " -> " . $value "<br>\n"; } } Hope that makes more sense ; ) Mike Wright Daniel Convissor wrote: > Hey Mike: > > mike wright wrote: > > > > Walking the array using list() = each( $HTTP_POST_VARS ) > > a typical output may look like this ( question -> answer ): > > > > 1 -> 3 > > 2 -> 7 > > 4 -> 9 > > 4 -> 10 > > 4 ->13 > > 7 -> 22 > > Do you REALLY mean that? How is "4" a key three times? > > Just making sure I understand what's going on here. > > --Dan > > -- > T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y > More than just answers. Solutions. (SM) > http://www.analysisandsolutions.com/ > 4015 7 Av #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409

« previous php.general (#18941) next »