Re: [PHP] Array problem in PHP. Please help.
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Array problem in PHP. Please help.
foreach($oldArray as $a)) { list($key, $value) = each($a); $newArray[$key] = $value; } > -Original Message- > From: Michael Champagne [mailto:[EMAIL PROTECTED]] > Sent: 12 iulie 2001 17:37 > To: PHP General Mailing List > Subject: [PHP] Array problem in PHP. Please help. > > > 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 ) > [2] => Array ( [symbol] => Symbol ) > [3] => Array ( [blank] => Blank Field ) > [4] => Array ( [account] => Broker Account ) > [5] => Array ( [symbol_desc] => Symbol Description ) > [6] => Array ( [symbol_desc] => Symbol Description ) > [7] => Array ( [first_money] => First Money ) ) > > Array ( [trade_date] => Trade Date > [settle_date] => Settlement Date > [symbol] => Symbol > [account] => Broker Account > [symbol_desc] => Symbol Description > [first_money] => First Money > [buy_sell] => Buy/Sell [comm] ) > > > -- > Michael Champagne, Software Engineer > Capital Institutional Services, Inc. > wk: [EMAIL PROTECTED] > hm: [EMAIL PROTECTED] > > > > ** > This communication is for informational purposes only. It is not > intended as an offer or solicitation for the purchase or sale of > any financial instrument or as an official confirmation of any > transaction, unless specifically agreed otherwise. All market > prices, data and other information are not warranted as to > completeness or accuracy and are subject to change without > notice. Any comments or statements made herein do not > necessarily reflect the views or opinions of Capital Institutional > Services, Inc. Capital Institutional Services, Inc. accepts no > liability for any errors or omissions arising as a result of > transmission. Use of this communication by other than intended > recipients is prohibited. > ** > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: > [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Array problem in PHP. Please help.
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 ) [2] => Array ( [symbol] => Symbol ) [3] => Array ( [blank] => Blank Field ) [4] => Array ( [account] => Broker Account ) [5] => Array ( [symbol_desc] => Symbol Description ) [6] => Array ( [symbol_desc] => Symbol Description ) [7] => Array ( [first_money] => First Money ) ) Array ( [trade_date] => Trade Date [settle_date] => Settlement Date [symbol] => Symbol [account] => Broker Account [symbol_desc] => Symbol Description [first_money] => First Money [buy_sell] => Buy/Sell [comm] ) -- Michael Champagne, Software Engineer Capital Institutional Services, Inc. wk: [EMAIL PROTECTED] hm: [EMAIL PROTECTED] ** This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction, unless specifically agreed otherwise. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect the views or opinions of Capital Institutional Services, Inc. Capital Institutional Services, Inc. accepts no liability for any errors or omissions arising as a result of transmission. Use of this communication by other than intended recipients is prohibited. ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]