Lets say I have the following array:
$array_1 = [
'Green' => 'Tea',
'Apple' => 'Juice',
'Black' => 'Coffee',
];
How do I flip the key => value of only one part of the array to something like this:
$array_2 = [
'Tea' => 'Green',
'Apple' => 'Juice',
'Black' => 'Coffee',
];
I know there is a function array_flip()
but it flips the whole array, how do I go about flipping only a selected key value pair in the array?