The only difference I see in map and foreach is that map is returning an array and forEach is not. However, I don\'t even understand the last line
map
forEach
TL;DR answer --
map always returns another array.
forEach does not. It is up to you to decide what it does. Return an array if you want or do something else if you don't.
Flexibility is desirable is certain situations. If it isn't for what you are dealing with then use map.