Re: Array problem in PHP. Please help.

From: Date: Thu, 12 Jul 2001 19:58:36 +0000
Subject: Re: Array problem in PHP. Please help.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-57639@lists.php.net to get a copy of this message
On Thursday 12 July 2001 16:37, Michael Champagne wrote: > Ok, here's the print_r() output of my 2 arrays. The first really just > has an extra dimension. How can I get the format of the first one > looking like the bottom one (just an array of key => value pairs)? > > Thanks! > > Array ( [0] => Array ( [trade_date] => Trade Date ) > [1] => Array ( [settle_date] => Settlement Date ) [...] > Array ( [trade_date] => Trade Date > [settle_date] => Settlement Date Hmm, try this: $DestArray = array (); foreach ($SrcArray as $Foo) { foreach (array_keys ($Foo) as $Key) { $DestArray [$Key] = $Foo [$Key]; } } $DestArray should be what you want after this treatment... -- Christian Reiniger LGDC Webmaster (http://lgdc.sunsite.dk/) "Never doubt that a small group of thoughtful, committed people can change the world... Indeed, it's the only thing that ever has." - Margaret Mead

« previous php.general (#57639) next »