I have the following given associative array, showing me how many items I have of each key.
'story' => 10
'image' => 20
'video' => 30
'audio' => 40
I'm trying to transform the array so I can use the key string inside my value, I want to get the following result
'story' => 'Story (10)'
'image' => 'Image (20)'
'video' => 'Video (30)'
'audio' => 'Audio (40)'
I've tried
I've tried the following method, but it resets the keys to indexes (0, 1, 2, 3)
return array_map(function ($key, $value) {
return $key . "(" . $value . ")";
}, array_keys($mergedArray), $mergedArray);