I would like to do this with a single function.
I have a key=>value pair:
14=>1
I have an array containing many such pairs:
array(15=>2, 16=>7, 4=>9)
I want a function which will add the key=>value pair to the array in case it is not already there but it will remove it from the array if it is already there.
I would like to have a single function for this.
1 Answer