Possible Duplicate:
array_splice() for associative arrays
How to add an array value to the middle of an associative array?
How can I add a new [key] => [value] pair after a specific Associative Key in an Assoc Array in PHP ?
For example, let's say we have an array called $fruits:
array {
[apple] => 1
[banana] => 3
[orange] => 4
}
How can I add [plum] => 2 to $fruits so that it appears after the [apple] key but before [banana] key ?
Thanks.