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

Home » Imported messages » comp.lang.php » Inserting into associative array
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Inserting into associative array [message #169903] Wed, 29 September 2010 19:31 Go to previous message
Jonathan Stein is currently offline  Jonathan Stein
Messages: 43
Registered: September 2010
Karma:
Member
Hi.

Let's say I have an array like
array(
'fruit' => 'banana',
'color' => 'yellow'
)

Now I want to insert
'shape' => 'round'
between 'fruit' and 'color'. I would think that PHP had a simple
solution for that, but I haven't found it... My solution is to loop
through the original array and build a new one.

Does anyone have a better solution?

Regards

Jonathan
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: PHP 5.3.3 Crashes on Win7
Next Topic: Dot in array key name
Goto Forum:
  

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

Current Time: Wed Nov 27 20:04:22 GMT 2024

Total time taken to generate the page: 0.04251 seconds