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
Re: Inserting into associative array [message #169904 is a reply to message #169903] Wed, 29 September 2010 20:05 Go to previous messageGo to previous message
Michael Fesser is currently offline  Michael Fesser
Messages: 215
Registered: September 2010
Karma:
Senior Member
.oO(Jonathan Stein)

> 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?

Nope. But maybe you could explain why you need such a special order,
which can't be achieved with the given array sorting functions.

Micha
[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: Sun Nov 24 04:57:51 GMT 2024

Total time taken to generate the page: 0.05218 seconds