map iterates over the array, as you suspected it would... in the case you provide, you use a push in the first example, but don't in the second. So, you're seeing the default, Larry-thought-it-wise behavior in the second.
Rewrite that map statement so that it, too, uses push, and it oughta do what you expected.
In reply to Re: foreach/map equivalency
by gloryhack
in thread foreach/map equivalency
by rob_au
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |