Page 1 of 1

simple array manipulation

Posted: Sat Sep 20, 2008 7:28 am
by AudiS2
Let say I have an example array('color'=>'green', 'size'=>'big')

How can I insert 'weight'=>'heavy' at the beginning of array?

array_unshift would not accept 'weight'=>'heavy' as a parametar.

Re: simple array manipulation

Posted: Sat Sep 20, 2008 7:39 am
by adroit
You can use combination of array_fill_keys() and array_unshift() function.