0
What is the use of an associative array? Why not just make an object and call it a day?
2 ответов
0
I'd like to know too
0
Actually you can just use the object, since after you create an array but use it like an associative array its treated the same was like any other object.
Why do we still want to initialize an array first?
I guess this is some coding standard. Like this you show to someone else that you intent to use the object as a list and not as an object which represents a single thing.
As long as your consistent and name your variables in a meaningful way you can do it the way you want.
Though it has always been a good idea to follow some of the wide spread guidelines.