Say I have an array:
$array = Array(
\'foo\' => 5,
\'bar\' => 12,
\'baz\' => 8
);
And I\'d like to print a line of text in m
Taking help from the answer of @linepogl, I edited the code to make it more simple, and it works fine.
function array_map_assoc($array){
$r = array();
foreach ($array as $key=>$value)
$r[$key] = "$key ($value)";
return $r;
}
And then, just call the function using
echo implode(' , ', array_map_assoc($array));