FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Problem: Read array of array into flat array
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Problem: Read array of array into flat array [message #170868] Sat, 04 December 2010 11:27 Go to previous message
gina is currently offline  gina
Messages: 2
Registered: December 2010
Karma:
Junior Member
Hey there.

I am having a problem with that array and I don't seem to get my head round
so thought I better ask for some good help ;)


....
foreach ($detailsArray as $details) {
$counter++;
foreach ($details as $key => $value) {

$arrayData[] = array(
'id'.$counter => $value->getId(),
'detail'.$counter => $value->getDetailText()
);
}



rather than an array of array I'd like to have an array containing the
values all in a flat form

the function should return an array like:

$resultArray = array('id1' =>'1', detail1 => 'ABC', id2 =>'1', detail2 =>
'DEF');


How am I going to achieve this ?

TIA gin
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: comp.lang.php
Next Topic: Efficiency of a lot of variables
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Mon Nov 25 00:44:33 GMT 2024

Total time taken to generate the page: 0.04042 seconds