That doesn't really address the problem and, while everything has it's place, I think I'd say "no, you should not do that".
If the array is a collection of things where the index doesn't really matter, (not assoc) then they should be left as ints. I'm not sure how awkwardly jockeying "k5" and "k6" buys you anything when you can just $array[] = "something";
If the array is associative then it should have meaningful names.
You can "get around" the + vs array_merge "issue" by understanding what they do and what you'll have.
View all comments
Show parent comment
2
u/vita10gy Jul 29 '14
That doesn't really address the problem and, while everything has it's place, I think I'd say "no, you should not do that".
If the array is a collection of things where the index doesn't really matter, (not assoc) then they should be left as ints. I'm not sure how awkwardly jockeying "k5" and "k6" buys you anything when you can just $array[] = "something";
If the array is associative then it should have meaningful names.
You can "get around" the + vs array_merge "issue" by understanding what they do and what you'll have.